2 Wrapper routines that use a PXE-enabled NIC option ROM to
3 supply internal routines for an EFI SNI (Simple Network
6 This file relies upon the existence of a PXE-compliant ROM
7 in memory, as defined by the Preboot Execution Environment
8 Specification (PXE), Version 2.1, located at
10 http://developer.intel.com/ial/wfm/wfmspecs.htm
12 Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
14 SPDX-License-Identifier: BSD-2-Clause-Patent
18 #include "BiosSnp16.h"
23 Op-Code: PXENV_START_UNDI (0000h)
24 Input: Far pointer to a PXENV_START_UNDI_T parameter structure that has been initialized by the caller.
25 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
26 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
28 Description: This service is used to pass the BIOS parameter registers to the UNDI driver. The UNDI driver is
29 responsible for saving the information it needs to communicate with the hardware.
30 This service is also responsible for hooking the Int 1Ah service routine
31 Note: This API service must be called only once during UNDI Option ROM boot.
32 The UNDI driver is responsible for saving this information and using it every time
33 PXENV_UNDI_STARTUP is called.
34 Service cannot be used in protected mode.
43 Set before calling API service
44 AX, BX, DX, DI, ES: BIOS initialization parameter registers. These
45 fields should contain the same information passed to the option ROM
46 initialization routine by the Host System BIOS. Information about the
47 contents of these registers can be found in the [PnP], [PCI] and
49 Returned from API service
50 Status: See the PXENV_STATUS_xxx constants.
52 @param SimpleNetworkDevice Device instance
53 @param PxeUndiTable Point to structure which hold parameter and return value
56 @return Return value of PXE option ROM far call.
60 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
61 IN OUT PXENV_START_UNDI_T
*PxeUndiTable
67 sizeof (PXENV_START_UNDI_T
),
75 Op-Code: PXENV_UNDI_STARTUP (0001h)
76 Input: Far pointer to a PXENV_UNDI_STARTUP_T parameter structure that has been initialized by the
78 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
79 the parameter structure must be set to one of the values represented by the
80 PXENV_STATUS_xxx constants.
81 Description: This API is responsible for initializing the contents of the UNDI code & data segment for proper
82 operation. Information from the !PXE structure and the first PXENV_START_UNDI API call is used
83 to complete this initialization. The rest of the UNDI APIs will not be available until this call has
85 Note: PXENV_UNDI_STARTUP must not be called again without first calling
87 PXENV_UNDI_STARTUP and PXENV_UNDI_SHUTDOWN are no longer responsible for
88 chaining interrupt 1Ah. This must be done by the PXENV_START_UNDI and
89 PXENV_STOP_UNDI API calls.
90 This service cannot be used in protected mode.
94 } PXENV_UNDI_STARTUP_T;
95 Set before calling API service
97 Returned from API service
98 Status: See the PXENV_STATUS_xxx constants.
100 @param SimpleNetworkDevice Device instance
101 @param PxeUndiTable Point to structure which hold parameter and return value
104 @return Return value of PXE option ROM far call.
108 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
109 IN OUT PXENV_UNDI_STARTUP_T
*PxeUndiTable
115 sizeof (PXENV_UNDI_STARTUP_T
),
123 Op-Code: PXENV_UNDI_CLEANUP (0002h)
124 Input: Far pointer to a PXENV_UNDI_CLEANUP_T parameter structure.
125 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field
126 in the parameter structure must be set to one of the values represented by the
127 PXENV_STATUS_xxx constants.
128 Description: This call will prepare the network adapter driver to be unloaded from memory. This call must be
129 made just before unloading the Universal NIC Driver. The rest of the API will not be available
130 after this call executes.
131 This service cannot be used in protected mode.
134 } PXENV_UNDI_CLEANUP_T;
135 Set before calling API service
137 Returned from API service
138 Status: See the PXENV_STATUS_xxx constants.
140 @param SimpleNetworkDevice Device instance
141 @param PxeUndiTable Point to structure which hold parameter and return value
144 @return Return value of PXE option ROM far call.
148 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
149 IN OUT PXENV_UNDI_CLEANUP_T
*PxeUndiTable
155 sizeof (PXENV_UNDI_CLEANUP_T
),
163 Op-Code: PXENV_UNDI_INITIALIZE (0003h)
164 Input: Far pointer to a PXENV_UNDI_INITIALIZE_T parameter structure that has been initialized by the
166 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
167 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
169 Description: This call resets the adapter and programs it with default parameters. The default parameters used
170 are those supplied to the most recent UNDI_STARTUP call. This routine does not enable the
171 receive and transmit units of the network adapter to readily receive or transmit packets. The
172 application must call PXENV_UNDI_OPEN to logically connect the network adapter to the network.
173 This call must be made by an application to establish an interface to the network adapter driver.
174 Note: When the PXE code makes this call to initialize the network adapter, it passes a NULL pointer for
175 the Protocol field in the parameter structure.
180 } PXENV_UNDI_INITIALIZE_T;
181 Set before calling API service
182 ProtocolIni: Physical address of a memory copy of the driver
183 module from the protocol.ini file obtained from the protocol manager
184 driver (refer to the NDIS 2.0 specification). This parameter is
185 supported for the universal NDIS driver to pass the information
186 contained in the protocol.ini file to the NIC driver for any specific
187 configuration of the NIC. (Note that the module identification in the
188 protocol.ini file was done by NDIS.) This value can be NULL for any
189 other application interfacing to the universal NIC driver
190 Returned from API service
191 Status: See the PXENV_STATUS_xxx constants.
193 @param SimpleNetworkDevice Device instance
194 @param PxeUndiTable Point to structure which hold parameter and return value
197 @return Return value of PXE option ROM far call.
201 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
202 IN OUT PXENV_UNDI_INITIALIZE_T
*PxeUndiTable
208 sizeof (PXENV_UNDI_INITIALIZE_T
),
209 PXENV_UNDI_INITIALIZE
214 Wrapper routine for reset adapter.
218 Op-Code: PXENV_UNDI_RESET_ADAPTER (0004h)
219 Input: Far pointer to a PXENV_UNDI_RESET_ADAPTER_t parameter structure that has been initialized
221 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
222 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
224 Description: This call resets and reinitializes the network adapter with the same set of parameters supplied to
225 Initialize Routine. Unlike Initialize, this call opens the adapter that is, it connects logically to the
226 network. This routine cannot be used to replace Initialize or Shutdown calls.
229 PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;
230 } PXENV_UNDI_RESET_T;
232 #define MAXNUM_MCADDR 8
235 UINT16 MCastAddrCount;
236 MAC_ADDR McastAddr[MAXNUM_MCADDR];
237 } PXENV_UNDI_MCAST_ADDRESS_t;
239 Set before calling API service
240 R_Mcast_Buf: This is a structure of MCastAddrCount and
242 MCastAddrCount: Number of multicast MAC addresses in the
244 McastAddr: List of up to MAXNUM_MCADDR multicast MAC
246 Returned from API service
247 Status: See the PXENV_STATUS_xxx constants.
249 @param SimpleNetworkDevice Device instance.
250 @param PxeUndiTable Point to structure which hold parameter and return value
252 @param RxFilter Filter setting mask value for PXE recive .
254 @return Return value of PXE option ROM far call.
258 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
259 IN OUT PXENV_UNDI_RESET_T
*PxeUndiTable
,
263 PXENV_UNDI_OPEN_T Open
;
264 PXENV_UNDI_CLOSE_T Close
;
267 Status
= MakePxeCall (
270 sizeof (PXENV_UNDI_RESET_T
),
273 if (!EFI_ERROR(Status
)) {
277 Close
.Status
= PXENV_STATUS_SUCCESS
;
279 Status
= MakePxeCall (
285 if (EFI_ERROR(Status
)) {
286 return EFI_DEVICE_ERROR
;
289 Status
= MakePxeCall (
292 sizeof (PXENV_UNDI_RESET_T
),
295 if (EFI_ERROR(Status
)) {
296 return EFI_DEVICE_ERROR
;
299 Open
.Status
= PXENV_STATUS_SUCCESS
;
301 Open
.PktFilter
= RxFilter
;
304 &PxeUndiTable
->R_Mcast_Buf
,
305 sizeof (PXENV_UNDI_MCAST_ADDR_T
)
309 Status
= MakePxeCall (
315 if (EFI_ERROR(Status
)) {
316 return EFI_DEVICE_ERROR
;
325 Op-Code: PXENV_UNDI_SHUTDOWN (0005h)
326 Input: Far pointer to a PXENV_UNDI_SHUTDOWN_T parameter.
327 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
328 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
330 Description: This call resets the network adapter and leaves it in a safe state for another driver to program it.
331 Note: The contents of the PXENV_UNDI_STARTUP parameter structure need to be saved by the
332 Universal NIC Driver in case PXENV_UNDI_INITIALIZE is called again.
336 } PXENV_UNDI_SHUTDOWN_T;
337 Set before calling API service
339 Returned from API service
340 Status: See the PXENV_STATUS_xxx constants.
342 @param SimpleNetworkDevice Device instance
343 @param PxeUndiTable Point to structure which hold parameter and return value
346 @return Return value of PXE option ROM far call.
350 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
351 IN OUT PXENV_UNDI_SHUTDOWN_T
*PxeUndiTable
357 sizeof (PXENV_UNDI_SHUTDOWN_T
),
365 Op-Code: PXENV_UNDI_OPEN (0006h)
366 Input: Far pointer to a PXENV_UNDI_OPEN_T parameter structure that has been initialized by the caller.
367 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
368 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
370 Description: This call activates the adapter network connection and sets the adapter ready to accept packets
371 for transmit and receive.
376 #define FLTR_DIRECTED 0x0001
377 #define FLTR_BRDCST 0x0002
378 #define FLTR_PRMSCS 0x0004
379 #define FLTR_SRC_RTG 0x0008
380 PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;
382 Set before calling API service
383 OpenFlag: This is an adapter specific input parameter. This is
384 supported for the universal NDIS 2.0 driver to pass in the open flags
385 provided by the protocol driver. (See the NDIS 2.0 specification.)
387 PktFilter: Filter for receiving packets. This can be one, or more, of
388 the FLTR_xxx constants. Multiple values are arithmetically or-ed
390 directed packets are packets that may come to your MAC address
391 or the multicast MAC address.
392 R_Mcast_Buf: See definition in UNDI RESET ADAPTER (0004h).
393 Returned from API service
394 Status: See the PXENV_STATUS_xxx constants.
396 @param SimpleNetworkDevice Device instance
397 @param PxeUndiTable Point to structure which hold parameter and return value
400 @return Return value of PXE option ROM far call.
404 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
405 IN OUT PXENV_UNDI_OPEN_T
*PxeUndiTable
411 sizeof (PXENV_UNDI_OPEN_T
),
419 Op-Code: PXENV_UNDI_CLOSE (0007h)
420 Input: Far pointer to a PXENV_UNDI_CLOSE_T parameter.
421 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
422 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
424 Description: This call disconnects the network adapter from the network. Packets cannot be transmitted or
425 received until the network adapter is open again.
428 } PXENV_UNDI_CLOSE_T;
429 Set before calling API service
431 Returned from API service
432 Status: See the PXENV_STATUS_xxx constants.
434 @param SimpleNetworkDevice Device instance
435 @param PxeUndiTable Point to structure which hold parameter and return value
438 @return Return value of PXE option ROM far call.
442 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
443 IN OUT PXENV_UNDI_CLOSE_T
*PxeUndiTable
449 sizeof (PXENV_UNDI_CLOSE_T
),
457 Op-Code: PXENV_UNDI_TRANSMIT (0008h)
458 Input: Far pointer to a PXENV_UNDI_TRANSMIT_T parameter structure that
459 has been initialized by the caller.
460 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX.
461 The status code must be set to one of the values represented by the
462 PXENV_STATUS_xxx constants.
463 Description: This call transmits a buffer to the network. The media header
464 for the packet can be filled by the calling protocol, but it might not be.
465 The network adapter driver will fill it if required by the values in the
466 parameter block. The packet is buffered for transmission provided there is
467 an available buffer, and the function returns PXENV_EXIT_SUCCESS. If no
468 buffer is available the function returns PXENV_EXIT_FAILURE with a status
469 code of PXE_UNDI_STATUS__OUT OF_RESOURCE. The number of buffers is
470 implementation-dependent. An interrupt is generated on completion of the
471 transmission of one or more packets. A call to PXENV_UNDI_TRANSMIT is
472 permitted in the context of a transmit complete interrupt.
482 #define XMT_DESTADDR 0x0000
483 #define XMT_BROADCAST 0x0001
487 } t_PXENV_UNDI_TRANSMIT;
489 #define MAX_DATA_BLKS 8
500 } DataBlock[MAX_DATA_BLKS];
503 Set before calling API service
504 Protocol: This is the protocol of the upper layer that is calling UNDI
505 TRANSMIT call. If the upper layer has filled the media header, this
506 field must be P_UNKNOWN.
507 XmitFlag: If this flag is XMT_DESTADDR, the NIC driver expects a
508 pointer to the destination media address in the field DestAddr. If
509 XMT_BROADCAST, the NIC driver fills the broadcast address for the
511 TBD: Segment:Offset address of the transmit buffer descriptor.
512 ImmedLength: Length of the immediate transmit buffer: Xmit.
513 Xmit: Segment:Offset of the immediate transmit buffer.
514 DataBlkCount: Number of blocks in this transmit buffer.
516 0 => 32-bit physical address in TDDataPtr (not supported in this
518 1 => segment:offset in TDDataPtr which can be a real mode or 16-bit
519 protected mode pointer
520 TDRsvdByte: Reserved must be zero.
521 TDDatalen: Data block length in bytes.
522 TDDataPtr: Segment:Offset of the transmit block.
523 DataBlock: Array of transmit data blocks.
524 Returned from API service
525 Status: See the PXENV_STATUS_xxx constants
527 @param SimpleNetworkDevice Device instance
528 @param PxeUndiTable Point to structure which hold parameter and return value
531 @return Return value of PXE option ROM far call.
535 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
536 IN OUT PXENV_UNDI_TRANSMIT_T
*PxeUndiTable
541 Status
= MakePxeCall (
544 sizeof (PXENV_UNDI_TRANSMIT_T
),
547 if (Status
== EFI_SUCCESS
) {
551 switch (PxeUndiTable
->Status
) {
552 case PXENV_STATUS_OUT_OF_RESOURCES
:
553 return EFI_NOT_READY
;
556 return EFI_DEVICE_ERROR
;
564 UNDI SET STATION ADDRESS
565 Op-Code: PXENV_UNDI_SET_STATION_ADDRESS (000Ah)
566 Input: Far pointer to a PXENV_UNDI_SET_STATION_ADDRESS_t parameter structure that has been
567 initialized by the caller.
568 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
569 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
571 Description: This call sets the MAC address to be the input value and is called before opening the network
572 adapter. Later, the open call uses this variable as a temporary MAC address to program the
573 adapter individual address registers.
576 MAC_ADDR StationAddress;
577 } PXENV_UNDI_SET_STATION_ADDR_T;
578 Set before calling API service
579 StationAddress: Temporary MAC address to be used for
580 transmit and receive.
581 Returned from API service
582 Status: See the PXENV_STATUS_xxx constants.
584 @param SimpleNetworkDevice Device instance
585 @param PxeUndiTable Point to structure which hold parameter and return value
588 @return Return value of PXE option ROM far call.
591 PxeUndiSetStationAddr (
592 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
593 IN OUT PXENV_UNDI_SET_STATION_ADDR_T
*PxeUndiTable
599 sizeof (PXENV_UNDI_SET_STATION_ADDR_T
),
600 PXENV_UNDI_SET_STATION_ADDR
606 UNDI SET PACKET FILTER
607 Op-Code: PXENV_UNDI_SET_PACKET_FILTER (000Bh)
608 Input: Far pointer to a PXENV_UNDI_SET_PACKET_FILTER_T parameter structure that has been
609 initialized by the caller.
610 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
611 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
613 Description: This call resets the adapter's receive unit to accept a new filter, different from the one provided with
618 } PXENV_UNDI_SET_PACKET_FILTER_T;
619 Set before calling API service
620 Filter: See the receive filter values in the UNDI OPEN
621 (0006h) API description.
622 Returned from API service
623 Status: See the PXENV_STATUS_xxx constants.
625 @param SimpleNetworkDevice Device instance
626 @param PxeUndiTable Point to structure which hold parameter and return value
629 @return Return value of PXE option ROM far call.
635 Op-Code: PXENV_UNDI_GET_INFORMATION (000Ch)
636 Input: Far pointer to a PXENV_UNDI_GET_INFORMATION_T parameter structure that has been
637 initialized by the caller.
638 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
639 the parameter structure must be set to one of the values represented by the
640 PXENV_STATUS_xxx constants.
641 Description: This call copies the network adapter variables, including the MAC address, into the input buffer.
642 Note: The PermNodeAddress field must be valid after PXENV_START_UNDI and
643 PXENV_UNDI_STARTUP have been issued. All other fields must be valid after
644 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE have been
653 #define EXP_ETHER_TYPE 2
655 #define ARCNET_TYPE 7
657 MAC_ADDR CurrentNodeAddress;
658 MAC_ADDR PermNodeAddress;
662 } PXENV_UNDI_GET_INFORMATION_T;
663 Set before calling API service
665 Returned from API service
666 Status: See the PXENV_STATUS_xxx constants.
667 BaseIO: Adapter base I/O address.
668 IntNumber: Adapter IRQ number.
669 MaxTranUnit: Adapter maximum transmit unit.
670 HWType: Type of protocol at the hardware level.
671 HWAddrLen: Length of the hardware address.
672 CurrentNodeAddress: Current hardware address.
673 PermNodeAddress: Permanent hardware address.
674 ROMAddress: Real mode ROM segment address.
675 RxBufCnt: Receive queue length.
676 TxBufCnt: Transmit queue length.
678 @param SimpleNetworkDevice Device instance
679 @param PxeUndiTable Point to structure which hold parameter and return value
682 @return Return value of PXE option ROM far call.
685 PxeUndiGetInformation (
686 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
687 IN OUT PXENV_UNDI_GET_INFORMATION_T
*PxeUndiTable
693 sizeof (PXENV_UNDI_GET_INFORMATION_T
),
694 PXENV_UNDI_GET_INFORMATION
701 Op-Code: PXENV_UNDI_GET_STATISTICS (000Dh)
702 Input: Far pointer to a PXENV_UNDI_GET_STATISTICS_T parameter structure that has been initialized
704 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
705 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
707 Description: This call reads statistical information from the network adapter, and returns.
710 UINT32 XmtGoodFrames;
711 UINT32 RcvGoodFrames;
713 UINT32 RcvResourceErrors;
714 } PXENV_UNDI_GET_STATISTICS_T;
715 Set before calling API service
717 Returned from API service
718 Status: See the PXENV_STATUS_xxx constants.
719 XmtGoodFrames: Number of successful transmissions.
720 RcvGoodFrames: Number of good frames received.
721 RcvCRCErrors: Number of frames received with CRC
723 RcvResourceErrors: Number of frames discarded
724 because receive queue was full.
726 @param SimpleNetworkDevice Device instance
727 @param PxeUndiTable Point to structure which hold parameter and return value
730 @return Return value of PXE option ROM far call.
733 PxeUndiGetStatistics (
734 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
735 IN OUT PXENV_UNDI_GET_STATISTICS_T
*PxeUndiTable
741 sizeof (PXENV_UNDI_GET_STATISTICS_T
),
742 PXENV_UNDI_GET_STATISTICS
748 UNDI CLEAR STATISTICS
749 Op-Code: PXENV_UNDI_CLEAR_STATISTICS (000Eh)
750 Input: Far pointer to a PXENV_UNDI_CLEAR_STATISTICS_T parameter.
751 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
752 the parameter structure must be set to one of the values represented by the
753 PXENV_STATUS_xxx constants.
754 Description: This call clears the statistical information from the network adapter.
757 } PXENV_UNDI_CLEAR_STATISTICS_T;
758 Set before calling API service
760 Returned from API service
761 Status: See the PXENV_STATUS_xxx constants.
763 @param SimpleNetworkDevice Device instance
764 @param PxeUndiTable Point to structure which hold parameter and return value
767 @return Return value of PXE option ROM far call.
770 PxeUndiClearStatistics (
771 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
772 IN OUT PXENV_UNDI_CLEAR_STATISTICS_T
*PxeUndiTable
778 sizeof (PXENV_UNDI_CLEAR_STATISTICS_T
),
779 PXENV_UNDI_CLEAR_STATISTICS
786 Op-Code: PXENV_UNDI_INITIATE_DIAGS (000Fh)
787 Input: Far pointer to a PXENV_UNDI_INITIATE_DIAGS_T parameter.
788 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
789 the parameter structure must be set to one of the values represented by the
790 PXENV_STATUS_xxx constants.
791 Description: This call can be used to initiate the run-time diagnostics. It causes the network adapter to run
792 hardware diagnostics and to update its status information.
795 } PXENV_UNDI_INITIATE_DIAGS_T;
796 Set before calling API service
798 Returned from API service
799 Status: See the PXENV_STATUS_xxx constants.
801 @param SimpleNetworkDevice Device instance
802 @param PxeUndiTable Point to structure which hold parameter and return value
805 @return Return value of PXE option ROM far call.
811 Op-Code: PXENV_UNDI_FORCE_INTERRUPT (0010h)
812 Input: Far pointer to a PXENV_UNDI_FORCE_INTERRUPT_T parameter structure that has been
813 initialized by the caller.
814 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
815 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
817 Description: This call forces the network adapter to generate an interrupt. When a receive interrupt occurs, the
818 network adapter driver usually queues the packet and calls the application's callback receive
819 routine with a pointer to the packet received. Then, the callback routine either can copy the packet
820 to its buffer or can decide to delay the copy to a later time. If the packet is not immediately copied,
821 the network adapter driver does not remove it from the input queue. When the application wants to
822 copy the packet, it can call the PXENV_UNDI_FORCE_INTERRUPT routine to simulate the receive
826 } PXENV_UNDI_FORCE_INTERRUPT_T;
827 Set before calling API service
829 Returned from API service
830 Status: See the PXENV_STATUS_xxx constants.
832 @param SimpleNetworkDevice Device instance
833 @param PxeUndiTable Point to structure which hold parameter and return value
836 @return Return value of PXE option ROM far call.
841 UNDI GET MULTICAST ADDRESS
842 Op-Code: PXENV_UNDI_GET_MCAST_ADDRESS (0011h)
843 Input: Far pointer to a PXENV_GET_MCAST_ADDRESS_t parameter structure that has been initialized
845 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
846 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
848 Description: This call converts the given IP multicast address to a hardware multicast address.
853 } PXENV_UNDI_GET_MCAST_ADDR_T;
854 Set before calling API service
855 InetAddr: IP multicast address.
856 Returned from API service
857 Status: See the PXENV_STATUS_xxx constants.
858 MediaAddr: MAC multicast address.
860 @param SimpleNetworkDevice Device instance
861 @param PxeUndiTable Point to structure which hold parameter and return value
864 @return Return value of PXE option ROM far call.
867 PxeUndiGetMcastAddr (
868 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
869 IN OUT PXENV_UNDI_GET_MCAST_ADDR_T
*PxeUndiTable
875 sizeof (PXENV_UNDI_GET_MCAST_ADDR_T
),
876 PXENV_UNDI_GET_MCAST_ADDR
883 Op-Code: PXENV_UNDI_GET_NIC_TYPE (0012h)
884 Input: Far pointer to a PXENV_UNDI_GET_NIC_TYPE parameter structure that has been initialized by
886 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
887 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
888 constants. If the PXENV_EXIT_SUCCESS is returned the parameter structure must contain the
890 Description: This call, if successful, provides the NIC-specific information necessary to identify the network
891 adapter that is used to boot the system.
892 Note: The application first gets the DHCPDISCOVER packet using GET_CACHED_INFO and checks if
893 the UNDI is supported before making this call. If the UNDI is not supported, the NIC-specific
894 information can be obtained from the DHCPDISCOVER packet itself.
895 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called
896 before the information provided is valid.
902 #define CardBus_NIC 4
923 } PXENV_UNDI_GET_NIC_TYPE_T;
924 Set before calling API service
926 Returned from API service
927 Status: See the PXENV_STATUS_xxx constants.
928 NICType: Type of NIC information stored in the parameter
930 Info: Information about the fields in this union can be found
931 in the [PnP] and [PCI] specifications
933 @param SimpleNetworkDevice Device instance
934 @param PxeUndiTable Point to structure which hold parameter and return value
937 @return Return value of PXE option ROM far call.
941 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
942 IN OUT PXENV_UNDI_GET_NIC_TYPE_T
*PxeUndiTable
948 sizeof (PXENV_UNDI_GET_NIC_TYPE_T
),
949 PXENV_UNDI_GET_NIC_TYPE
956 Op-Code: PXENV_UNDI_GET_IFACE_INFO (0013h)
957 Input: Far pointer to a PXENV_UNDI_GET_IFACE_INFO_t parameter structure that has been initialized
959 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
960 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
961 constants. If the PXENV_EXIT_SUCCESS is returned, the parameter structure must contain the
962 interface specific information.
963 Description: This call, if successful, provides the network interface specific information such as the interface
964 type at the link layer (Ethernet, Tokenring) and the link speed. This information can be used in the
965 universal drivers such as NDIS or Miniport to communicate to the upper protocol modules.
966 Note: UNDI follows the NDIS2 specification in giving this information. It is the responsibility of the
967 universal driver to translate/convert this information into a format that is required in its specification
968 or to suit the expectation of the upper level protocol modules.
969 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called
970 before the information provided is valid.
977 } PXENV_UNDI_GET_NDIS_INFO_T;
978 Set before calling API service
980 Returned from API service
981 Status: See the PXENV_STATUS_xxx constants.
982 IfaceType: Name of MAC type in ASCIIZ format. This is
983 used by the universal NDIS driver to specify its driver type
984 to the protocol driver.
985 LinkSpeed: Defined in the NDIS 2.0 specification.
986 ServiceFlags: Defined in the NDIS 2.0 specification.
987 Reserved: Must be zero.
989 @param SimpleNetworkDevice Device instance
990 @param PxeUndiTable Point to structure which hold parameter and return value
993 @return Return value of PXE option ROM far call.
997 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
998 IN OUT PXENV_UNDI_GET_NDIS_INFO_T
*PxeUndiTable
1001 return MakePxeCall (
1002 SimpleNetworkDevice
,
1004 sizeof (PXENV_UNDI_GET_NDIS_INFO_T
),
1005 PXENV_UNDI_GET_NDIS_INFO
1012 Op-Code: PXENV_UNDI_ISR (0014h)
1013 Input: Far pointer to a PXENV_UNDI_ISR_T parameter structure that has been initialized by the caller.
1014 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1015 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1017 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in
1018 the parameter block indicates the operation to be performed for the call. This field is filled with the
1019 status of that operation on return.
1020 Note: Interrupt Service Routine Operation:
1021 In this design the UNDI does not hook the interrupt for the Network Interface. Instead, the
1022 application or the protocol driver hooks the interrupt and calls UNDI with the PXENV_UNDI_ISR
1023 API call for interrupt verification (PXENV_UNDI_ISR_IN_START) and processing
1024 (PXENV_UNDI_ISR_IN_PROCESS and PXENV_UNDI_ISR_GET_NEXT).
1025 When the Network Interface HW generates an interrupt the protocol driver interrupt service
1026 routine (ISR) gets control and takes care of the interrupt processing at the PIC level. The ISR then
1027 calls the UNDI using the PXENV_UNDI_ISR API with the value PXENV_UNDI_ISR_IN_START for
1028 the FuncFlag parameter. At this time UNDI must disable the interrupts at the Network Interface
1029 level and read any status values required to further process the interrupt. UNDI must return as
1030 quickly as possible with one of the two values, PXENV_UNDI_ISR_OUT_OURS or
1031 PXENV_UNDI_ISR_OUT_NOT_OURS, for the parameter FuncFlag depending on whether the
1032 interrupt was generated by this particular Network Interface or not.
1033 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_NOT_OURS, then the interrupt was
1034 not generated by our NIC, and interrupt processing is complete.
1035 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_OURS, the protocol driver must start
1036 a handler thread and send an end-of-interrupt (EOI) command to the PIC. Interrupt processing is
1038 The protocol driver strategy routine will call UNDI using this same API with FuncFlag equal to
1039 PXENV_UNDI_ISR_IN_PROCESS. At this time UNDI must find the cause of this interrupt and
1040 return the status in the FuncFlag. It first checks if there is a frame received and if so it returns the
1041 first buffer pointer of that frame in the parameter block.
1042 The protocol driver calls UNDI repeatedly with the FuncFlag equal to
1043 PXENV_UNDI_ISR_IN_GET_NEXT to get all the buffers in a frame and also all the received
1044 frames in the queue. On this call, UNDI must remember the previous buffer given to the protoco,l
1045 remove it from the receive queue and recycle it. In case of a multi-buffered frame, if the previous
1046 buffer is not the last buffer in the frame it must return the next buffer in the frame in the parameter
1047 block. Otherwise it must return the first buffer in the next frame.
1048 If there is no received frame pending to be processed, UNDI processes the transmit completes and
1049 if there is no other interrupt status to be processed, UNDI re-enables the interrupt at the
1050 NETWORK INTERFACE level and returns PXENV_UNDI_ISR_OUT_DONE in the FuncFlag.
1051 IMPORTANT: It is possible for the protocol driver to be interrupted again while in the
1052 strategy routine when the UNDI re-enables interrupts.
1054 @param SimpleNetworkDevice Device instance
1055 @param PxeUndiTable Point to structure which hold parameter and return value
1056 for option ROM call.
1058 @return Return value of PXE option ROM far call.
1062 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
1063 IN OUT PXENV_UNDI_ISR_T
*PxeUndiTable
1066 return MakePxeCall (
1067 SimpleNetworkDevice
,
1069 sizeof (PXENV_UNDI_ISR_T
),
1077 Op-Code: PXENV_STOP_UNDI (0015h)
1078 Input: Far pointer to a PXENV_STOP_UNDI_T parameter structure that has been initialized by the caller.
1079 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1080 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1082 Description: This routine is responsible for unhooking the Int 1Ah service routine.
1083 Note: This API service must be called only once at the end of UNDI Option ROM boot. One of the valid
1084 status codes is PXENV_STATUS_KEEP. If this status is returned, UNDI must not be removed from
1085 base memory. Also, UNDI must not be removed from base memory if BC is not removed from base
1087 Service cannot be used in protected mode.
1089 PXENV_STATUS Status;
1090 } PXENV_STOP_UNDI_T;
1091 Set before calling API service
1093 Returned from API service
1094 Status: See the PXENV_STATUS_xxx constants.
1096 @param SimpleNetworkDevice Device instance
1097 @param PxeUndiTable Point to structure which hold parameter and return value
1098 for option ROM call.
1100 @return Return value of PXE option ROM far call.
1104 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
1105 IN OUT PXENV_STOP_UNDI_T
*PxeUndiTable
1108 return MakePxeCall (
1109 SimpleNetworkDevice
,
1111 sizeof (PXENV_STOP_UNDI_T
),
1119 Op-Code: PXENV_UNDI_GET_STATE (0015h)
1120 Input: Far pointer to a PXENV_UNDI_GET_STATE_T parameter.
1121 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1122 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1123 constants. The UNDI_STATE field in the parameter structure must be set to one of the valid state
1125 Description: This call can be used to obtain state of the UNDI engine in order to avoid issuing adverse call
1128 #define PXE_UNDI_GET_STATE_STARTED 1
1129 #define PXE_UNDI_GET_STATE_INITIALIZED 2
1130 #define PXE_UNDI_GET_STATE_OPENED 3
1131 PXENV_STATUS Status;
1133 } PXENV_UNDI_GET_STATE_T;
1134 Set before calling API service
1136 Returned from API service
1137 Status: See the PXENV_STATUS_xxx constants.
1138 State: See definitions of the state constants.
1139 Note. UNDI implementation is responsible for maintaining
1140 internal state machine.
1142 Op-Code: PXENV_UNDI_ISR (0014h)
1143 Input: Far pointer to a t_PXENV_UNDI_ISR parameter structure that has been initialized by the caller.
1144 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1145 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1147 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in
1148 the parameter block indicates the operation to be performed for the call. This field is filled with the
1149 status of that operation on return.
1151 @param SimpleNetworkDevice Device instance
1152 @param PxeUndiTable Point to structure which hold parameter and return value
1153 for option ROM call.
1155 @return Return value of PXE option ROM far call.