]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Csm/BiosThunk/Snp16Dxe/PxeUndi.c
IntelFrameworkModulePkg: Clean up source files
[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
567/**\r
0a6f4824 568 PXE\r
bcecde14 569 UNDI SET MULTICAST ADDRESS\r
570 Op-Code: PXENV_UNDI_SET_MCAST_ADDRESS (0009h)\r
571 Input: Far pointer to a PXENV_TFTP_SET_MCAST_ADDRESS_t parameter structure that has been\r
572 initialized by the caller.\r
573 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
574 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
575 constants.\r
576 Description: This call changes the current list of multicast addresses to the input list and resets the network\r
577 adapter to accept it. If the number of multicast addresses is zero, multicast is disabled.\r
578 typedef struct {\r
579 PXENV_STATUS Status;\r
580 PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;\r
581 } PXENV_UNDI_SET_MCAST_ADDR_T;\r
582 Set before calling API service\r
583 R_Mcast_Buf: See description in the UNDI RESET ADAPTER\r
584 (0004h) API.\r
585 Returned from API service\r
0a6f4824
LG
586 Status: See the PXENV_STATUS_xxx constants\r
587\r
bcecde14 588 @param SimpleNetworkDevice Device instance\r
0a6f4824 589 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 590 for option ROM call.\r
0a6f4824
LG
591\r
592 @return Return value of PXE option ROM far call.\r
bcecde14 593**/\r
594EFI_STATUS\r
595PxeUndiSetMcastAddr (\r
596 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
597 IN OUT PXENV_UNDI_SET_MCAST_ADDR_T *PxeUndiTable\r
598 )\r
599{\r
600 return MakePxeCall (\r
601 SimpleNetworkDevice,\r
602 PxeUndiTable,\r
603 sizeof (PXENV_UNDI_SET_MCAST_ADDR_T),\r
604 PXENV_UNDI_SET_MCAST_ADDR\r
605 );\r
606}\r
607\r
608/**\r
0a6f4824 609 PXE\r
bcecde14 610 UNDI SET STATION ADDRESS\r
611 Op-Code: PXENV_UNDI_SET_STATION_ADDRESS (000Ah)\r
612 Input: Far pointer to a PXENV_UNDI_SET_STATION_ADDRESS_t parameter structure that has been\r
613 initialized by the caller.\r
614 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
615 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
616 constants.\r
617 Description: This call sets the MAC address to be the input value and is called before opening the network\r
618 adapter. Later, the open call uses this variable as a temporary MAC address to program the\r
619 adapter individual address registers.\r
620 typedef struct {\r
621 PXENV_STATUS Status;\r
622 MAC_ADDR StationAddress;\r
623 } PXENV_UNDI_SET_STATION_ADDR_T;\r
624 Set before calling API service\r
625 StationAddress: Temporary MAC address to be used for\r
626 transmit and receive.\r
627 Returned from API service\r
0a6f4824
LG
628 Status: See the PXENV_STATUS_xxx constants.\r
629\r
bcecde14 630 @param SimpleNetworkDevice Device instance\r
0a6f4824 631 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 632 for option ROM call.\r
0a6f4824
LG
633\r
634 @return Return value of PXE option ROM far call.\r
bcecde14 635**/\r
636EFI_STATUS\r
637PxeUndiSetStationAddr (\r
638 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
639 IN OUT PXENV_UNDI_SET_STATION_ADDR_T *PxeUndiTable\r
640 )\r
641{\r
642 return MakePxeCall (\r
643 SimpleNetworkDevice,\r
644 PxeUndiTable,\r
645 sizeof (PXENV_UNDI_SET_STATION_ADDR_T),\r
646 PXENV_UNDI_SET_STATION_ADDR\r
647 );\r
648}\r
649\r
650/**\r
0a6f4824 651 PXE\r
bcecde14 652 UNDI SET PACKET FILTER\r
653 Op-Code: PXENV_UNDI_SET_PACKET_FILTER (000Bh)\r
654 Input: Far pointer to a PXENV_UNDI_SET_PACKET_FILTER_T parameter structure that has been\r
655 initialized by the caller.\r
656 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
657 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
658 constants.\r
659 Description: This call resets the adapter's receive unit to accept a new filter, different from the one provided with\r
660 the open call.\r
661 typedef struct {\r
662 PXENV_STATUS Status;\r
663 UINT8 filter;\r
664 } PXENV_UNDI_SET_PACKET_FILTER_T;\r
665 Set before calling API service\r
666 Filter: See the receive filter values in the UNDI OPEN\r
667 (0006h) API description.\r
668 Returned from API service\r
0a6f4824
LG
669 Status: See the PXENV_STATUS_xxx constants.\r
670\r
bcecde14 671 @param SimpleNetworkDevice Device instance\r
0a6f4824 672 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 673 for option ROM call.\r
0a6f4824
LG
674\r
675 @return Return value of PXE option ROM far call.\r
bcecde14 676**/\r
677EFI_STATUS\r
678PxeUndiSetPacketFilter (\r
679 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
680 IN OUT PXENV_UNDI_SET_PACKET_FILTER_T *PxeUndiTable\r
681 )\r
682{\r
683 return MakePxeCall (\r
684 SimpleNetworkDevice,\r
685 PxeUndiTable,\r
686 sizeof (PXENV_UNDI_SET_PACKET_FILTER_T),\r
687 PXENV_UNDI_SET_PACKET_FILTER\r
688 );\r
689}\r
690\r
691/**\r
0a6f4824 692 PXE\r
bcecde14 693 UNDI GET INFORMATION\r
694 Op-Code: PXENV_UNDI_GET_INFORMATION (000Ch)\r
695 Input: Far pointer to a PXENV_UNDI_GET_INFORMATION_T parameter structure that has been\r
696 initialized by the caller.\r
697 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
698 the parameter structure must be set to one of the values represented by the\r
699 PXENV_STATUS_xxx constants.\r
700 Description: This call copies the network adapter variables, including the MAC address, into the input buffer.\r
701 Note: The PermNodeAddress field must be valid after PXENV_START_UNDI and\r
702 PXENV_UNDI_STARTUP have been issued. All other fields must be valid after\r
703 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE have been\r
704 called.\r
705 typedef struct {\r
706 PXENV_STATUS Status;\r
707 UINT16 BaseIo;\r
708 UINT16 IntNumber;\r
709 UINT16 MaxTranUnit;\r
710 UINT16 HwType;\r
711 #define ETHER_TYPE 1\r
712 #define EXP_ETHER_TYPE 2\r
713 #define IEEE_TYPE 6\r
714 #define ARCNET_TYPE 7\r
715 UINT16 HwAddrLen;\r
716 MAC_ADDR CurrentNodeAddress;\r
717 MAC_ADDR PermNodeAddress;\r
718 SEGSEL ROMAddress;\r
719 UINT16 RxBufCt;\r
720 UINT16 TxBufCt;\r
721 } PXENV_UNDI_GET_INFORMATION_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 BaseIO: Adapter base I/O address.\r
727 IntNumber: Adapter IRQ number.\r
728 MaxTranUnit: Adapter maximum transmit unit.\r
729 HWType: Type of protocol at the hardware level.\r
730 HWAddrLen: Length of the hardware address.\r
731 CurrentNodeAddress: Current hardware address.\r
732 PermNodeAddress: Permanent hardware address.\r
733 ROMAddress: Real mode ROM segment address.\r
734 RxBufCnt: Receive queue length.\r
0a6f4824
LG
735 TxBufCnt: Transmit queue length.\r
736\r
bcecde14 737 @param SimpleNetworkDevice Device instance\r
0a6f4824 738 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 739 for option ROM call.\r
0a6f4824
LG
740\r
741 @return Return value of PXE option ROM far call.\r
bcecde14 742**/\r
743EFI_STATUS\r
744PxeUndiGetInformation (\r
745 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
746 IN OUT PXENV_UNDI_GET_INFORMATION_T *PxeUndiTable\r
747 )\r
748{\r
749 return MakePxeCall (\r
750 SimpleNetworkDevice,\r
751 PxeUndiTable,\r
752 sizeof (PXENV_UNDI_GET_INFORMATION_T),\r
753 PXENV_UNDI_GET_INFORMATION\r
754 );\r
755}\r
756\r
757/**\r
0a6f4824 758 PXE\r
bcecde14 759 UNDI GET STATISTICS\r
760 Op-Code: PXENV_UNDI_GET_STATISTICS (000Dh)\r
761 Input: Far pointer to a PXENV_UNDI_GET_STATISTICS_T parameter structure that has been initialized\r
762 by the caller.\r
763 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
764 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
765 constants.\r
766 Description: This call reads statistical information from the network adapter, and returns.\r
767 typedef struct {\r
768 PXENV_STATUS Status;\r
769 UINT32 XmtGoodFrames;\r
770 UINT32 RcvGoodFrames;\r
771 UINT32 RcvCRCErrors;\r
772 UINT32 RcvResourceErrors;\r
773 } PXENV_UNDI_GET_STATISTICS_T;\r
774 Set before calling API service\r
775 N/A\r
776 Returned from API service\r
777 Status: See the PXENV_STATUS_xxx constants.\r
778 XmtGoodFrames: Number of successful transmissions.\r
779 RcvGoodFrames: Number of good frames received.\r
780 RcvCRCErrors: Number of frames received with CRC\r
781 error.\r
782 RcvResourceErrors: Number of frames discarded\r
783 because receive queue was full.\r
0a6f4824 784\r
bcecde14 785 @param SimpleNetworkDevice Device instance\r
0a6f4824 786 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 787 for option ROM call.\r
0a6f4824
LG
788\r
789 @return Return value of PXE option ROM far call.\r
bcecde14 790**/\r
791EFI_STATUS\r
792PxeUndiGetStatistics (\r
793 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
794 IN OUT PXENV_UNDI_GET_STATISTICS_T *PxeUndiTable\r
795 )\r
796{\r
797 return MakePxeCall (\r
798 SimpleNetworkDevice,\r
799 PxeUndiTable,\r
800 sizeof (PXENV_UNDI_GET_STATISTICS_T),\r
801 PXENV_UNDI_GET_STATISTICS\r
802 );\r
803}\r
804\r
805/**\r
0a6f4824 806 PXE\r
bcecde14 807 UNDI CLEAR STATISTICS\r
808 Op-Code: PXENV_UNDI_CLEAR_STATISTICS (000Eh)\r
809 Input: Far pointer to a PXENV_UNDI_CLEAR_STATISTICS_T parameter.\r
810 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
811 the parameter structure must be set to one of the values represented by the\r
812 PXENV_STATUS_xxx constants.\r
813 Description: This call clears the statistical information from the network adapter.\r
814 typedef struct {\r
815 PXENV_STATUS Status;\r
816 } PXENV_UNDI_CLEAR_STATISTICS_T;\r
817 Set before calling API service\r
818 N/A\r
819 Returned from API service\r
820 Status: See the PXENV_STATUS_xxx constants.\r
0a6f4824 821\r
bcecde14 822 @param SimpleNetworkDevice Device instance\r
0a6f4824 823 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 824 for option ROM call.\r
0a6f4824
LG
825\r
826 @return Return value of PXE option ROM far call.\r
bcecde14 827**/\r
828EFI_STATUS\r
829PxeUndiClearStatistics (\r
830 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
831 IN OUT PXENV_UNDI_CLEAR_STATISTICS_T *PxeUndiTable\r
832 )\r
833{\r
834 return MakePxeCall (\r
835 SimpleNetworkDevice,\r
836 PxeUndiTable,\r
837 sizeof (PXENV_UNDI_CLEAR_STATISTICS_T),\r
838 PXENV_UNDI_CLEAR_STATISTICS\r
839 );\r
840}\r
841\r
842/**\r
0a6f4824 843 PXE\r
bcecde14 844 UNDI INITIATE DIAGS\r
845 Op-Code: PXENV_UNDI_INITIATE_DIAGS (000Fh)\r
846 Input: Far pointer to a PXENV_UNDI_INITIATE_DIAGS_T parameter.\r
847 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
848 the parameter structure must be set to one of the values represented by the\r
849 PXENV_STATUS_xxx constants.\r
850 Description: This call can be used to initiate the run-time diagnostics. It causes the network adapter to run\r
851 hardware diagnostics and to update its status information.\r
852 typedef struct {\r
853 PXENV_STATUS Status;\r
854 } PXENV_UNDI_INITIATE_DIAGS_T;\r
855 Set before calling API service\r
856 N/A\r
857 Returned from API service\r
0a6f4824
LG
858 Status: See the PXENV_STATUS_xxx constants.\r
859\r
bcecde14 860 @param SimpleNetworkDevice Device instance\r
0a6f4824 861 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 862 for option ROM call.\r
0a6f4824
LG
863\r
864 @return Return value of PXE option ROM far call.\r
bcecde14 865**/\r
866EFI_STATUS\r
867PxeUndiInitiateDiags (\r
868 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
869 IN OUT PXENV_UNDI_INITIATE_DIAGS_T *PxeUndiTable\r
870 )\r
871{\r
872 return MakePxeCall (\r
873 SimpleNetworkDevice,\r
874 PxeUndiTable,\r
875 sizeof (PXENV_UNDI_INITIATE_DIAGS_T),\r
876 PXENV_UNDI_INITIATE_DIAGS\r
877 );\r
878}\r
879\r
880/**\r
0a6f4824 881 PXE\r
bcecde14 882 UNDI FORCE INTERRUPT\r
883 Op-Code: PXENV_UNDI_FORCE_INTERRUPT (0010h)\r
884 Input: Far pointer to a PXENV_UNDI_FORCE_INTERRUPT_T parameter structure that has been\r
885 initialized by the caller.\r
886 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
887 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
888 constants.\r
889 Description: This call forces the network adapter to generate an interrupt. When a receive interrupt occurs, the\r
890 network adapter driver usually queues the packet and calls the application's callback receive\r
891 routine with a pointer to the packet received. Then, the callback routine either can copy the packet\r
892 to its buffer or can decide to delay the copy to a later time. If the packet is not immediately copied,\r
893 the network adapter driver does not remove it from the input queue. When the application wants to\r
894 copy the packet, it can call the PXENV_UNDI_FORCE_INTERRUPT routine to simulate the receive\r
895 interrupt.\r
896 typedef struct {\r
897 PXENV_STATUS Status;\r
898 } PXENV_UNDI_FORCE_INTERRUPT_T;\r
899 Set before calling API service\r
900 N/A\r
901 Returned from API service\r
0a6f4824
LG
902 Status: See the PXENV_STATUS_xxx constants.\r
903\r
bcecde14 904 @param SimpleNetworkDevice Device instance\r
0a6f4824 905 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 906 for option ROM call.\r
0a6f4824
LG
907\r
908 @return Return value of PXE option ROM far call.\r
bcecde14 909**/\r
910EFI_STATUS\r
911PxeUndiForceInterrupt (\r
912 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
913 IN OUT PXENV_UNDI_FORCE_INTERRUPT_T *PxeUndiTable\r
914 )\r
915{\r
916 return MakePxeCall (\r
917 SimpleNetworkDevice,\r
918 PxeUndiTable,\r
919 sizeof (PXENV_UNDI_FORCE_INTERRUPT_T),\r
920 PXENV_UNDI_FORCE_INTERRUPT\r
921 );\r
922}\r
923\r
924/**\r
0a6f4824 925 PXE\r
bcecde14 926 UNDI GET MULTICAST ADDRESS\r
927 Op-Code: PXENV_UNDI_GET_MCAST_ADDRESS (0011h)\r
928 Input: Far pointer to a PXENV_GET_MCAST_ADDRESS_t parameter structure that has been initialized\r
929 by the caller.\r
930 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
931 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
932 constants.\r
933 Description: This call converts the given IP multicast address to a hardware multicast address.\r
934 typedef struct {\r
935 PXENV_STATUS Status;\r
936 IP4 InetAddr;\r
937 MAC_ADDR MediaAddr;\r
938 } PXENV_UNDI_GET_MCAST_ADDR_T;\r
939 Set before calling API service\r
940 InetAddr: IP multicast address.\r
941 Returned from API service\r
942 Status: See the PXENV_STATUS_xxx constants.\r
943 MediaAddr: MAC multicast address.\r
0a6f4824 944\r
bcecde14 945 @param SimpleNetworkDevice Device instance\r
0a6f4824 946 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 947 for option ROM call.\r
0a6f4824
LG
948\r
949 @return Return value of PXE option ROM far call.\r
bcecde14 950**/\r
951EFI_STATUS\r
952PxeUndiGetMcastAddr (\r
953 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
954 IN OUT PXENV_UNDI_GET_MCAST_ADDR_T *PxeUndiTable\r
955 )\r
956{\r
957 return MakePxeCall (\r
958 SimpleNetworkDevice,\r
959 PxeUndiTable,\r
960 sizeof (PXENV_UNDI_GET_MCAST_ADDR_T),\r
961 PXENV_UNDI_GET_MCAST_ADDR\r
962 );\r
963}\r
964\r
965/**\r
0a6f4824 966 PXE\r
bcecde14 967 UNDI GET NIC TYPE\r
968 Op-Code: PXENV_UNDI_GET_NIC_TYPE (0012h)\r
969 Input: Far pointer to a PXENV_UNDI_GET_NIC_TYPE parameter structure that has been initialized by\r
970 the caller.\r
971 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
972 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
973 constants. If the PXENV_EXIT_SUCCESS is returned the parameter structure must contain the\r
974 NIC information.\r
975 Description: This call, if successful, provides the NIC-specific information necessary to identify the network\r
976 adapter that is used to boot the system.\r
977 Note: The application first gets the DHCPDISCOVER packet using GET_CACHED_INFO and checks if\r
978 the UNDI is supported before making this call. If the UNDI is not supported, the NIC-specific\r
979 information can be obtained from the DHCPDISCOVER packet itself.\r
980 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called\r
981 before the information provided is valid.\r
982 typedef {\r
983 PXENV_STATUS Status;\r
984 UINT8 NicType;\r
985 #define PCI_NIC 2\r
986 #define PnP_NIC 3\r
987 #define CardBus_NIC 4\r
988 Union {\r
989 Struct {\r
990 UINT16 Vendor_ID;\r
991 UINT16 Dev_ID;\r
992 UINT8 Base_Class;\r
993 UINT8 Sub_Class;\r
994 UINT8 Prog_Intf;\r
995 UINT8 Rev;\r
996 UINT16 BusDevFunc;\r
997 UINT16 SubVendor_ID;\r
998 UINT16 SubDevice_ID;\r
999 } pci, cardbus;\r
1000 struct {\r
1001 UINT32 EISA_Dev_ID;\r
1002 UINT8 Base_Class;\r
1003 UINT8 Sub_Class;\r
1004 UINT8 Prog_Intf;\r
1005 UINT16 CardSelNum;\r
1006 } pnp;\r
1007 } info;\r
1008 } PXENV_UNDI_GET_NIC_TYPE_T;\r
1009 Set before calling API service\r
1010 N/A\r
1011 Returned from API service\r
1012 Status: See the PXENV_STATUS_xxx constants.\r
1013 NICType: Type of NIC information stored in the parameter\r
1014 structure.\r
1015 Info: Information about the fields in this union can be found\r
0a6f4824
LG
1016 in the [PnP] and [PCI] specifications\r
1017\r
bcecde14 1018 @param SimpleNetworkDevice Device instance\r
0a6f4824 1019 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 1020 for option ROM call.\r
0a6f4824
LG
1021\r
1022 @return Return value of PXE option ROM far call.\r
bcecde14 1023**/\r
1024EFI_STATUS\r
1025PxeUndiGetNicType (\r
1026 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
1027 IN OUT PXENV_UNDI_GET_NIC_TYPE_T *PxeUndiTable\r
1028 )\r
1029{\r
1030 return MakePxeCall (\r
1031 SimpleNetworkDevice,\r
1032 PxeUndiTable,\r
1033 sizeof (PXENV_UNDI_GET_NIC_TYPE_T),\r
1034 PXENV_UNDI_GET_NIC_TYPE\r
1035 );\r
1036}\r
1037\r
1038/**\r
0a6f4824 1039 PXE\r
bcecde14 1040 UNDI GET IFACE INFO\r
1041 Op-Code: PXENV_UNDI_GET_IFACE_INFO (0013h)\r
1042 Input: Far pointer to a PXENV_UNDI_GET_IFACE_INFO_t parameter structure that has been initialized\r
1043 by the caller.\r
1044 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
1045 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
1046 constants. If the PXENV_EXIT_SUCCESS is returned, the parameter structure must contain the\r
1047 interface specific information.\r
1048 Description: This call, if successful, provides the network interface specific information such as the interface\r
1049 type at the link layer (Ethernet, Tokenring) and the link speed. This information can be used in the\r
1050 universal drivers such as NDIS or Miniport to communicate to the upper protocol modules.\r
1051 Note: UNDI follows the NDIS2 specification in giving this information. It is the responsibility of the\r
1052 universal driver to translate/convert this information into a format that is required in its specification\r
1053 or to suit the expectation of the upper level protocol modules.\r
1054 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called\r
1055 before the information provided is valid.\r
1056 typedef struct {\r
1057 PXENV_STATUS Status\r
1058 UINT8 IfaceType[16];\r
1059 UINT32 LinkSpeed;\r
1060 UINT32 ServiceFlags;\r
1061 UINT32 Reserved[4];\r
1062 } PXENV_UNDI_GET_NDIS_INFO_T;\r
1063 Set before calling API service\r
1064 N/A\r
1065 Returned from API service\r
1066 Status: See the PXENV_STATUS_xxx constants.\r
1067 IfaceType: Name of MAC type in ASCIIZ format. This is\r
1068 used by the universal NDIS driver to specify its driver type\r
1069 to the protocol driver.\r
1070 LinkSpeed: Defined in the NDIS 2.0 specification.\r
1071 ServiceFlags: Defined in the NDIS 2.0 specification.\r
0a6f4824
LG
1072 Reserved: Must be zero.\r
1073\r
bcecde14 1074 @param SimpleNetworkDevice Device instance\r
0a6f4824 1075 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 1076 for option ROM call.\r
0a6f4824
LG
1077\r
1078 @return Return value of PXE option ROM far call.\r
bcecde14 1079**/\r
1080EFI_STATUS\r
1081PxeUndiGetNdisInfo (\r
1082 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
1083 IN OUT PXENV_UNDI_GET_NDIS_INFO_T *PxeUndiTable\r
1084 )\r
1085{\r
1086 return MakePxeCall (\r
1087 SimpleNetworkDevice,\r
1088 PxeUndiTable,\r
1089 sizeof (PXENV_UNDI_GET_NDIS_INFO_T),\r
1090 PXENV_UNDI_GET_NDIS_INFO\r
1091 );\r
1092}\r
1093\r
1094/**\r
0a6f4824 1095 PXE\r
bcecde14 1096 UNDI ISR\r
1097 Op-Code: PXENV_UNDI_ISR (0014h)\r
1098 Input: Far pointer to a PXENV_UNDI_ISR_T parameter structure that has been initialized by the caller.\r
1099 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
1100 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
1101 constants.\r
1102 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in\r
1103 the parameter block indicates the operation to be performed for the call. This field is filled with the\r
1104 status of that operation on return.\r
1105 Note: Interrupt Service Routine Operation:\r
1106 In this design the UNDI does not hook the interrupt for the Network Interface. Instead, the\r
1107 application or the protocol driver hooks the interrupt and calls UNDI with the PXENV_UNDI_ISR\r
1108 API call for interrupt verification (PXENV_UNDI_ISR_IN_START) and processing\r
1109 (PXENV_UNDI_ISR_IN_PROCESS and PXENV_UNDI_ISR_GET_NEXT).\r
1110 When the Network Interface HW generates an interrupt the protocol driver interrupt service\r
1111 routine (ISR) gets control and takes care of the interrupt processing at the PIC level. The ISR then\r
1112 calls the UNDI using the PXENV_UNDI_ISR API with the value PXENV_UNDI_ISR_IN_START for\r
1113 the FuncFlag parameter. At this time UNDI must disable the interrupts at the Network Interface\r
1114 level and read any status values required to further process the interrupt. UNDI must return as\r
1115 quickly as possible with one of the two values, PXENV_UNDI_ISR_OUT_OURS or\r
1116 PXENV_UNDI_ISR_OUT_NOT_OURS, for the parameter FuncFlag depending on whether the\r
1117 interrupt was generated by this particular Network Interface or not.\r
1118 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_NOT_OURS, then the interrupt was\r
1119 not generated by our NIC, and interrupt processing is complete.\r
1120 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_OURS, the protocol driver must start\r
1121 a handler thread and send an end-of-interrupt (EOI) command to the PIC. Interrupt processing is\r
1122 now complete.\r
1123 The protocol driver strategy routine will call UNDI using this same API with FuncFlag equal to\r
1124 PXENV_UNDI_ISR_IN_PROCESS. At this time UNDI must find the cause of this interrupt and\r
1125 return the status in the FuncFlag. It first checks if there is a frame received and if so it returns the\r
1126 first buffer pointer of that frame in the parameter block.\r
1127 The protocol driver calls UNDI repeatedly with the FuncFlag equal to\r
1128 PXENV_UNDI_ISR_IN_GET_NEXT to get all the buffers in a frame and also all the received\r
1129 frames in the queue. On this call, UNDI must remember the previous buffer given to the protoco,l\r
1130 remove it from the receive queue and recycle it. In case of a multi-buffered frame, if the previous\r
1131 buffer is not the last buffer in the frame it must return the next buffer in the frame in the parameter\r
1132 block. Otherwise it must return the first buffer in the next frame.\r
1133 If there is no received frame pending to be processed, UNDI processes the transmit completes and\r
1134 if there is no other interrupt status to be processed, UNDI re-enables the interrupt at the\r
1135 NETWORK INTERFACE level and returns PXENV_UNDI_ISR_OUT_DONE in the FuncFlag.\r
1136 IMPORTANT: It is possible for the protocol driver to be interrupted again while in the\r
0a6f4824
LG
1137 strategy routine when the UNDI re-enables interrupts.\r
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
1145EFI_STATUS\r
1146PxeUndiIsr (\r
1147 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
1148 IN OUT PXENV_UNDI_ISR_T *PxeUndiTable\r
1149 )\r
1150{\r
1151 return MakePxeCall (\r
1152 SimpleNetworkDevice,\r
1153 PxeUndiTable,\r
1154 sizeof (PXENV_UNDI_ISR_T),\r
1155 PXENV_UNDI_ISR\r
1156 );\r
1157}\r
1158\r
1159/**\r
0a6f4824 1160 PXE\r
bcecde14 1161 STOP UNDI\r
1162 Op-Code: PXENV_STOP_UNDI (0015h)\r
1163 Input: Far pointer to a PXENV_STOP_UNDI_T parameter structure that has been initialized by the caller.\r
1164 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
1165 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
1166 constants.\r
1167 Description: This routine is responsible for unhooking the Int 1Ah service routine.\r
1168 Note: This API service must be called only once at the end of UNDI Option ROM boot. One of the valid\r
1169 status codes is PXENV_STATUS_KEEP. If this status is returned, UNDI must not be removed from\r
1170 base memory. Also, UNDI must not be removed from base memory if BC is not removed from base\r
1171 memory.\r
1172 Service cannot be used in protected mode.\r
1173 typedef struct {\r
1174 PXENV_STATUS Status;\r
1175 } PXENV_STOP_UNDI_T;\r
1176 Set before calling API service\r
1177 N/A\r
1178 Returned from API service\r
0a6f4824
LG
1179 Status: See the PXENV_STATUS_xxx constants.\r
1180\r
bcecde14 1181 @param SimpleNetworkDevice Device instance\r
0a6f4824 1182 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 1183 for option ROM call.\r
0a6f4824
LG
1184\r
1185 @return Return value of PXE option ROM far call.\r
bcecde14 1186**/\r
1187EFI_STATUS\r
1188PxeUndiStop (\r
1189 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
1190 IN OUT PXENV_STOP_UNDI_T *PxeUndiTable\r
1191 )\r
1192{\r
1193 return MakePxeCall (\r
1194 SimpleNetworkDevice,\r
1195 PxeUndiTable,\r
1196 sizeof (PXENV_STOP_UNDI_T),\r
1197 PXENV_STOP_UNDI\r
1198 );\r
1199}\r
1200\r
1201/**\r
0a6f4824 1202 PXE\r
bcecde14 1203 UNDI GET STATE\r
1204 Op-Code: PXENV_UNDI_GET_STATE (0015h)\r
1205 Input: Far pointer to a PXENV_UNDI_GET_STATE_T parameter.\r
1206 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
1207 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
1208 constants. The UNDI_STATE field in the parameter structure must be set to one of the valid state\r
1209 constants\r
1210 Description: This call can be used to obtain state of the UNDI engine in order to avoid issuing adverse call\r
1211 sequences\r
1212 typedef struct {\r
1213 #define PXE_UNDI_GET_STATE_STARTED 1\r
1214 #define PXE_UNDI_GET_STATE_INITIALIZED 2\r
1215 #define PXE_UNDI_GET_STATE_OPENED 3\r
1216 PXENV_STATUS Status;\r
1217 UINT8 UNDIstate;\r
1218 } PXENV_UNDI_GET_STATE_T;\r
1219 Set before calling API service\r
1220 N/A\r
1221 Returned from API service\r
1222 Status: See the PXENV_STATUS_xxx constants.\r
1223 State: See definitions of the state constants.\r
1224 Note. UNDI implementation is responsible for maintaining\r
1225 internal state machine.\r
1226 UNDI ISR\r
1227 Op-Code: PXENV_UNDI_ISR (0014h)\r
1228 Input: Far pointer to a t_PXENV_UNDI_ISR parameter structure that has been initialized by the caller.\r
1229 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in\r
1230 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx\r
1231 constants.\r
1232 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in\r
1233 the parameter block indicates the operation to be performed for the call. This field is filled with the\r
0a6f4824
LG
1234 status of that operation on return.\r
1235\r
bcecde14 1236 @param SimpleNetworkDevice Device instance\r
0a6f4824 1237 @param PxeUndiTable Point to structure which hold parameter and return value\r
bcecde14 1238 for option ROM call.\r
0a6f4824
LG
1239\r
1240 @return Return value of PXE option ROM far call.\r
bcecde14 1241**/\r
1242EFI_STATUS\r
1243PxeUndiGetState (\r
1244 IN EFI_SIMPLE_NETWORK_DEV *SimpleNetworkDevice,\r
1245 IN OUT PXENV_UNDI_GET_STATE_T *PxeUndiTable\r
1246 )\r
1247{\r
1248 return MakePxeCall (\r
1249 SimpleNetworkDevice,\r
1250 PxeUndiTable,\r
1251 sizeof (PXENV_UNDI_GET_STATE_T),\r
1252 PXENV_UNDI_GET_STATE\r
1253 );\r
1254}\r