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 This program and the accompanying materials
15 are licensed and made available under the terms and conditions
16 of the BSD License which accompanies this distribution. The
17 full text of the license may be found at
18 http://opensource.org/licenses/bsd-license.php
20 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
21 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 #include "BiosSnp16.h"
30 Op-Code: PXENV_START_UNDI (0000h)
31 Input: Far pointer to a PXENV_START_UNDI_T parameter structure that has been initialized by the caller.
32 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
33 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
35 Description: This service is used to pass the BIOS parameter registers to the UNDI driver. The UNDI driver is
36 responsible for saving the information it needs to communicate with the hardware.
37 This service is also responsible for hooking the Int 1Ah service routine
38 Note: This API service must be called only once during UNDI Option ROM boot.
39 The UNDI driver is responsible for saving this information and using it every time
40 PXENV_UNDI_STARTUP is called.
41 Service cannot be used in protected mode.
50 Set before calling API service
51 AX, BX, DX, DI, ES: BIOS initialization parameter registers. These
52 fields should contain the same information passed to the option ROM
53 initialization routine by the Host System BIOS. Information about the
54 contents of these registers can be found in the [PnP], [PCI] and
56 Returned from API service
57 Status: See the PXENV_STATUS_xxx constants.
59 @param SimpleNetworkDevice Device instance
60 @param PxeUndiTable Point to structure which hold parameter and return value
63 @return Return value of PXE option ROM far call.
67 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
68 IN OUT PXENV_START_UNDI_T
*PxeUndiTable
74 sizeof (PXENV_START_UNDI_T
),
82 Op-Code: PXENV_UNDI_STARTUP (0001h)
83 Input: Far pointer to a PXENV_UNDI_STARTUP_T parameter structure that has been initialized by the
85 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
86 the parameter structure must be set to one of the values represented by the
87 PXENV_STATUS_xxx constants.
88 Description: This API is responsible for initializing the contents of the UNDI code & data segment for proper
89 operation. Information from the !PXE structure and the first PXENV_START_UNDI API call is used
90 to complete this initialization. The rest of the UNDI APIs will not be available until this call has
92 Note: PXENV_UNDI_STARTUP must not be called again without first calling
94 PXENV_UNDI_STARTUP and PXENV_UNDI_SHUTDOWN are no longer responsible for
95 chaining interrupt 1Ah. This must be done by the PXENV_START_UNDI and
96 PXENV_STOP_UNDI API calls.
97 This service cannot be used in protected mode.
101 } PXENV_UNDI_STARTUP_T;
102 Set before calling API service
104 Returned from API service
105 Status: See the PXENV_STATUS_xxx constants.
107 @param SimpleNetworkDevice Device instance
108 @param PxeUndiTable Point to structure which hold parameter and return value
111 @return Return value of PXE option ROM far call.
115 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
116 IN OUT PXENV_UNDI_STARTUP_T
*PxeUndiTable
122 sizeof (PXENV_UNDI_STARTUP_T
),
130 Op-Code: PXENV_UNDI_CLEANUP (0002h)
131 Input: Far pointer to a PXENV_UNDI_CLEANUP_T parameter structure.
132 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field
133 in the parameter structure must be set to one of the values represented by the
134 PXENV_STATUS_xxx constants.
135 Description: This call will prepare the network adapter driver to be unloaded from memory. This call must be
136 made just before unloading the Universal NIC Driver. The rest of the API will not be available
137 after this call executes.
138 This service cannot be used in protected mode.
141 } PXENV_UNDI_CLEANUP_T;
142 Set before calling API service
144 Returned from API service
145 Status: See the PXENV_STATUS_xxx constants.
147 @param SimpleNetworkDevice Device instance
148 @param PxeUndiTable Point to structure which hold parameter and return value
151 @return Return value of PXE option ROM far call.
155 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
156 IN OUT PXENV_UNDI_CLEANUP_T
*PxeUndiTable
162 sizeof (PXENV_UNDI_CLEANUP_T
),
170 Op-Code: PXENV_UNDI_INITIALIZE (0003h)
171 Input: Far pointer to a PXENV_UNDI_INITIALIZE_T parameter structure that has been initialized by the
173 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
174 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
176 Description: This call resets the adapter and programs it with default parameters. The default parameters used
177 are those supplied to the most recent UNDI_STARTUP call. This routine does not enable the
178 receive and transmit units of the network adapter to readily receive or transmit packets. The
179 application must call PXENV_UNDI_OPEN to logically connect the network adapter to the network.
180 This call must be made by an application to establish an interface to the network adapter driver.
181 Note: When the PXE code makes this call to initialize the network adapter, it passes a NULL pointer for
182 the Protocol field in the parameter structure.
187 } PXENV_UNDI_INITIALIZE_T;
188 Set before calling API service
189 ProtocolIni: Physical address of a memory copy of the driver
190 module from the protocol.ini file obtained from the protocol manager
191 driver (refer to the NDIS 2.0 specification). This parameter is
192 supported for the universal NDIS driver to pass the information
193 contained in the protocol.ini file to the NIC driver for any specific
194 configuration of the NIC. (Note that the module identification in the
195 protocol.ini file was done by NDIS.) This value can be NULL for any
196 other application interfacing to the universal NIC driver
197 Returned from API service
198 Status: See the PXENV_STATUS_xxx constants.
200 @param SimpleNetworkDevice Device instance
201 @param PxeUndiTable Point to structure which hold parameter and return value
204 @return Return value of PXE option ROM far call.
208 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
209 IN OUT PXENV_UNDI_INITIALIZE_T
*PxeUndiTable
215 sizeof (PXENV_UNDI_INITIALIZE_T
),
216 PXENV_UNDI_INITIALIZE
221 Wrapper routine for reset adapter.
225 Op-Code: PXENV_UNDI_RESET_ADAPTER (0004h)
226 Input: Far pointer to a PXENV_UNDI_RESET_ADAPTER_t parameter structure that has been initialized
228 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
229 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
231 Description: This call resets and reinitializes the network adapter with the same set of parameters supplied to
232 Initialize Routine. Unlike Initialize, this call opens the adapter that is, it connects logically to the
233 network. This routine cannot be used to replace Initialize or Shutdown calls.
236 PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;
237 } PXENV_UNDI_RESET_T;
239 #define MAXNUM_MCADDR 8
242 UINT16 MCastAddrCount;
243 MAC_ADDR McastAddr[MAXNUM_MCADDR];
244 } PXENV_UNDI_MCAST_ADDRESS_t;
246 Set before calling API service
247 R_Mcast_Buf: This is a structure of MCastAddrCount and
249 MCastAddrCount: Number of multicast MAC addresses in the
251 McastAddr: List of up to MAXNUM_MCADDR multicast MAC
253 Returned from API service
254 Status: See the PXENV_STATUS_xxx constants.
256 @param SimpleNetworkDevice Device instance.
257 @param PxeUndiTable Point to structure which hold parameter and return value
259 @param RxFilter Filter setting mask value for PXE recive .
261 @return Return value of PXE option ROM far call.
265 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
266 IN OUT PXENV_UNDI_RESET_T
*PxeUndiTable
,
270 PXENV_UNDI_OPEN_T Open
;
271 PXENV_UNDI_CLOSE_T Close
;
274 Status
= MakePxeCall (
277 sizeof (PXENV_UNDI_RESET_T
),
280 if (!EFI_ERROR(Status
)) {
284 Close
.Status
= PXENV_STATUS_SUCCESS
;
286 Status
= MakePxeCall (
292 if (EFI_ERROR(Status
)) {
293 return EFI_DEVICE_ERROR
;
296 Status
= MakePxeCall (
299 sizeof (PXENV_UNDI_RESET_T
),
302 if (EFI_ERROR(Status
)) {
303 return EFI_DEVICE_ERROR
;
306 Open
.Status
= PXENV_STATUS_SUCCESS
;
308 Open
.PktFilter
= RxFilter
;
311 &PxeUndiTable
->R_Mcast_Buf
,
312 sizeof (PXENV_UNDI_MCAST_ADDR_T
)
316 Status
= MakePxeCall (
322 if (EFI_ERROR(Status
)) {
323 return EFI_DEVICE_ERROR
;
332 Op-Code: PXENV_UNDI_SHUTDOWN (0005h)
333 Input: Far pointer to a PXENV_UNDI_SHUTDOWN_T parameter.
334 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
335 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
337 Description: This call resets the network adapter and leaves it in a safe state for another driver to program it.
338 Note: The contents of the PXENV_UNDI_STARTUP parameter structure need to be saved by the
339 Universal NIC Driver in case PXENV_UNDI_INITIALIZE is called again.
343 } PXENV_UNDI_SHUTDOWN_T;
344 Set before calling API service
346 Returned from API service
347 Status: See the PXENV_STATUS_xxx constants.
349 @param SimpleNetworkDevice Device instance
350 @param PxeUndiTable Point to structure which hold parameter and return value
353 @return Return value of PXE option ROM far call.
357 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
358 IN OUT PXENV_UNDI_SHUTDOWN_T
*PxeUndiTable
364 sizeof (PXENV_UNDI_SHUTDOWN_T
),
372 Op-Code: PXENV_UNDI_OPEN (0006h)
373 Input: Far pointer to a PXENV_UNDI_OPEN_T parameter structure that has been initialized by the caller.
374 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
375 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
377 Description: This call activates the adapter network connection and sets the adapter ready to accept packets
378 for transmit and receive.
383 #define FLTR_DIRECTED 0x0001
384 #define FLTR_BRDCST 0x0002
385 #define FLTR_PRMSCS 0x0004
386 #define FLTR_SRC_RTG 0x0008
387 PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;
389 Set before calling API service
390 OpenFlag: This is an adapter specific input parameter. This is
391 supported for the universal NDIS 2.0 driver to pass in the open flags
392 provided by the protocol driver. (See the NDIS 2.0 specification.)
394 PktFilter: Filter for receiving packets. This can be one, or more, of
395 the FLTR_xxx constants. Multiple values are arithmetically or-ed
397 directed packets are packets that may come to your MAC address
398 or the multicast MAC address.
399 R_Mcast_Buf: See definition in UNDI RESET ADAPTER (0004h).
400 Returned from API service
401 Status: See the PXENV_STATUS_xxx constants.
403 @param SimpleNetworkDevice Device instance
404 @param PxeUndiTable Point to structure which hold parameter and return value
407 @return Return value of PXE option ROM far call.
411 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
412 IN OUT PXENV_UNDI_OPEN_T
*PxeUndiTable
418 sizeof (PXENV_UNDI_OPEN_T
),
426 Op-Code: PXENV_UNDI_CLOSE (0007h)
427 Input: Far pointer to a PXENV_UNDI_CLOSE_T parameter.
428 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
429 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
431 Description: This call disconnects the network adapter from the network. Packets cannot be transmitted or
432 received until the network adapter is open again.
435 } PXENV_UNDI_CLOSE_T;
436 Set before calling API service
438 Returned from API service
439 Status: See the PXENV_STATUS_xxx constants.
441 @param SimpleNetworkDevice Device instance
442 @param PxeUndiTable Point to structure which hold parameter and return value
445 @return Return value of PXE option ROM far call.
449 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
450 IN OUT PXENV_UNDI_CLOSE_T
*PxeUndiTable
456 sizeof (PXENV_UNDI_CLOSE_T
),
464 Op-Code: PXENV_UNDI_TRANSMIT (0008h)
465 Input: Far pointer to a PXENV_UNDI_TRANSMIT_T parameter structure that
466 has been initialized by the caller.
467 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX.
468 The status code must be set to one of the values represented by the
469 PXENV_STATUS_xxx constants.
470 Description: This call transmits a buffer to the network. The media header
471 for the packet can be filled by the calling protocol, but it might not be.
472 The network adapter driver will fill it if required by the values in the
473 parameter block. The packet is buffered for transmission provided there is
474 an available buffer, and the function returns PXENV_EXIT_SUCCESS. If no
475 buffer is available the function returns PXENV_EXIT_FAILURE with a status
476 code of PXE_UNDI_STATUS__OUT OF_RESOURCE. The number of buffers is
477 implementation-dependent. An interrupt is generated on completion of the
478 transmission of one or more packets. A call to PXENV_UNDI_TRANSMIT is
479 permitted in the context of a transmit complete interrupt.
489 #define XMT_DESTADDR 0x0000
490 #define XMT_BROADCAST 0x0001
494 } t_PXENV_UNDI_TRANSMIT;
496 #define MAX_DATA_BLKS 8
507 } DataBlock[MAX_DATA_BLKS];
510 Set before calling API service
511 Protocol: This is the protocol of the upper layer that is calling UNDI
512 TRANSMIT call. If the upper layer has filled the media header, this
513 field must be P_UNKNOWN.
514 XmitFlag: If this flag is XMT_DESTADDR, the NIC driver expects a
515 pointer to the destination media address in the field DestAddr. If
516 XMT_BROADCAST, the NIC driver fills the broadcast address for the
518 TBD: Segment:Offset address of the transmit buffer descriptor.
519 ImmedLength: Length of the immediate transmit buffer: Xmit.
520 Xmit: Segment:Offset of the immediate transmit buffer.
521 DataBlkCount: Number of blocks in this transmit buffer.
523 0 => 32-bit physical address in TDDataPtr (not supported in this
525 1 => segment:offset in TDDataPtr which can be a real mode or 16-bit
526 protected mode pointer
527 TDRsvdByte: Reserved must be zero.
528 TDDatalen: Data block length in bytes.
529 TDDataPtr: Segment:Offset of the transmit block.
530 DataBlock: Array of transmit data blocks.
531 Returned from API service
532 Status: See the PXENV_STATUS_xxx constants
534 @param SimpleNetworkDevice Device instance
535 @param PxeUndiTable Point to structure which hold parameter and return value
538 @return Return value of PXE option ROM far call.
542 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
543 IN OUT PXENV_UNDI_TRANSMIT_T
*PxeUndiTable
548 Status
= MakePxeCall (
551 sizeof (PXENV_UNDI_TRANSMIT_T
),
554 if (Status
== EFI_SUCCESS
) {
558 switch (PxeUndiTable
->Status
) {
559 case PXENV_STATUS_OUT_OF_RESOURCES
:
560 return EFI_NOT_READY
;
563 return EFI_DEVICE_ERROR
;
569 UNDI SET MULTICAST ADDRESS
570 Op-Code: PXENV_UNDI_SET_MCAST_ADDRESS (0009h)
571 Input: Far pointer to a PXENV_TFTP_SET_MCAST_ADDRESS_t parameter structure that has been
572 initialized by the caller.
573 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
574 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
576 Description: This call changes the current list of multicast addresses to the input list and resets the network
577 adapter to accept it. If the number of multicast addresses is zero, multicast is disabled.
580 PXENV_UNDI_MCAST_ADDRESS_t R_Mcast_Buf;
581 } PXENV_UNDI_SET_MCAST_ADDR_T;
582 Set before calling API service
583 R_Mcast_Buf: See description in the UNDI RESET ADAPTER
585 Returned from API service
586 Status: See the PXENV_STATUS_xxx constants
588 @param SimpleNetworkDevice Device instance
589 @param PxeUndiTable Point to structure which hold parameter and return value
592 @return Return value of PXE option ROM far call.
595 PxeUndiSetMcastAddr (
596 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
597 IN OUT PXENV_UNDI_SET_MCAST_ADDR_T
*PxeUndiTable
603 sizeof (PXENV_UNDI_SET_MCAST_ADDR_T
),
604 PXENV_UNDI_SET_MCAST_ADDR
610 UNDI SET STATION ADDRESS
611 Op-Code: PXENV_UNDI_SET_STATION_ADDRESS (000Ah)
612 Input: Far pointer to a PXENV_UNDI_SET_STATION_ADDRESS_t parameter structure that has been
613 initialized by the caller.
614 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
615 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
617 Description: This call sets the MAC address to be the input value and is called before opening the network
618 adapter. Later, the open call uses this variable as a temporary MAC address to program the
619 adapter individual address registers.
622 MAC_ADDR StationAddress;
623 } PXENV_UNDI_SET_STATION_ADDR_T;
624 Set before calling API service
625 StationAddress: Temporary MAC address to be used for
626 transmit and receive.
627 Returned from API service
628 Status: See the PXENV_STATUS_xxx constants.
630 @param SimpleNetworkDevice Device instance
631 @param PxeUndiTable Point to structure which hold parameter and return value
634 @return Return value of PXE option ROM far call.
637 PxeUndiSetStationAddr (
638 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
639 IN OUT PXENV_UNDI_SET_STATION_ADDR_T
*PxeUndiTable
645 sizeof (PXENV_UNDI_SET_STATION_ADDR_T
),
646 PXENV_UNDI_SET_STATION_ADDR
652 UNDI SET PACKET FILTER
653 Op-Code: PXENV_UNDI_SET_PACKET_FILTER (000Bh)
654 Input: Far pointer to a PXENV_UNDI_SET_PACKET_FILTER_T parameter structure that has been
655 initialized by the caller.
656 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
657 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
659 Description: This call resets the adapter's receive unit to accept a new filter, different from the one provided with
664 } PXENV_UNDI_SET_PACKET_FILTER_T;
665 Set before calling API service
666 Filter: See the receive filter values in the UNDI OPEN
667 (0006h) API description.
668 Returned from API service
669 Status: See the PXENV_STATUS_xxx constants.
671 @param SimpleNetworkDevice Device instance
672 @param PxeUndiTable Point to structure which hold parameter and return value
675 @return Return value of PXE option ROM far call.
678 PxeUndiSetPacketFilter (
679 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
680 IN OUT PXENV_UNDI_SET_PACKET_FILTER_T
*PxeUndiTable
686 sizeof (PXENV_UNDI_SET_PACKET_FILTER_T
),
687 PXENV_UNDI_SET_PACKET_FILTER
694 Op-Code: PXENV_UNDI_GET_INFORMATION (000Ch)
695 Input: Far pointer to a PXENV_UNDI_GET_INFORMATION_T parameter structure that has been
696 initialized by the caller.
697 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
698 the parameter structure must be set to one of the values represented by the
699 PXENV_STATUS_xxx constants.
700 Description: This call copies the network adapter variables, including the MAC address, into the input buffer.
701 Note: The PermNodeAddress field must be valid after PXENV_START_UNDI and
702 PXENV_UNDI_STARTUP have been issued. All other fields must be valid after
703 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE have been
712 #define EXP_ETHER_TYPE 2
714 #define ARCNET_TYPE 7
716 MAC_ADDR CurrentNodeAddress;
717 MAC_ADDR PermNodeAddress;
721 } PXENV_UNDI_GET_INFORMATION_T;
722 Set before calling API service
724 Returned from API service
725 Status: See the PXENV_STATUS_xxx constants.
726 BaseIO: Adapter base I/O address.
727 IntNumber: Adapter IRQ number.
728 MaxTranUnit: Adapter maximum transmit unit.
729 HWType: Type of protocol at the hardware level.
730 HWAddrLen: Length of the hardware address.
731 CurrentNodeAddress: Current hardware address.
732 PermNodeAddress: Permanent hardware address.
733 ROMAddress: Real mode ROM segment address.
734 RxBufCnt: Receive queue length.
735 TxBufCnt: Transmit queue length.
737 @param SimpleNetworkDevice Device instance
738 @param PxeUndiTable Point to structure which hold parameter and return value
741 @return Return value of PXE option ROM far call.
744 PxeUndiGetInformation (
745 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
746 IN OUT PXENV_UNDI_GET_INFORMATION_T
*PxeUndiTable
752 sizeof (PXENV_UNDI_GET_INFORMATION_T
),
753 PXENV_UNDI_GET_INFORMATION
760 Op-Code: PXENV_UNDI_GET_STATISTICS (000Dh)
761 Input: Far pointer to a PXENV_UNDI_GET_STATISTICS_T parameter structure that has been initialized
763 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
764 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
766 Description: This call reads statistical information from the network adapter, and returns.
769 UINT32 XmtGoodFrames;
770 UINT32 RcvGoodFrames;
772 UINT32 RcvResourceErrors;
773 } PXENV_UNDI_GET_STATISTICS_T;
774 Set before calling API service
776 Returned from API service
777 Status: See the PXENV_STATUS_xxx constants.
778 XmtGoodFrames: Number of successful transmissions.
779 RcvGoodFrames: Number of good frames received.
780 RcvCRCErrors: Number of frames received with CRC
782 RcvResourceErrors: Number of frames discarded
783 because receive queue was full.
785 @param SimpleNetworkDevice Device instance
786 @param PxeUndiTable Point to structure which hold parameter and return value
789 @return Return value of PXE option ROM far call.
792 PxeUndiGetStatistics (
793 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
794 IN OUT PXENV_UNDI_GET_STATISTICS_T
*PxeUndiTable
800 sizeof (PXENV_UNDI_GET_STATISTICS_T
),
801 PXENV_UNDI_GET_STATISTICS
807 UNDI CLEAR STATISTICS
808 Op-Code: PXENV_UNDI_CLEAR_STATISTICS (000Eh)
809 Input: Far pointer to a PXENV_UNDI_CLEAR_STATISTICS_T parameter.
810 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
811 the parameter structure must be set to one of the values represented by the
812 PXENV_STATUS_xxx constants.
813 Description: This call clears the statistical information from the network adapter.
816 } PXENV_UNDI_CLEAR_STATISTICS_T;
817 Set before calling API service
819 Returned from API service
820 Status: See the PXENV_STATUS_xxx constants.
822 @param SimpleNetworkDevice Device instance
823 @param PxeUndiTable Point to structure which hold parameter and return value
826 @return Return value of PXE option ROM far call.
829 PxeUndiClearStatistics (
830 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
831 IN OUT PXENV_UNDI_CLEAR_STATISTICS_T
*PxeUndiTable
837 sizeof (PXENV_UNDI_CLEAR_STATISTICS_T
),
838 PXENV_UNDI_CLEAR_STATISTICS
845 Op-Code: PXENV_UNDI_INITIATE_DIAGS (000Fh)
846 Input: Far pointer to a PXENV_UNDI_INITIATE_DIAGS_T parameter.
847 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
848 the parameter structure must be set to one of the values represented by the
849 PXENV_STATUS_xxx constants.
850 Description: This call can be used to initiate the run-time diagnostics. It causes the network adapter to run
851 hardware diagnostics and to update its status information.
854 } PXENV_UNDI_INITIATE_DIAGS_T;
855 Set before calling API service
857 Returned from API service
858 Status: See the PXENV_STATUS_xxx constants.
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 PxeUndiInitiateDiags (
868 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
869 IN OUT PXENV_UNDI_INITIATE_DIAGS_T
*PxeUndiTable
875 sizeof (PXENV_UNDI_INITIATE_DIAGS_T
),
876 PXENV_UNDI_INITIATE_DIAGS
883 Op-Code: PXENV_UNDI_FORCE_INTERRUPT (0010h)
884 Input: Far pointer to a PXENV_UNDI_FORCE_INTERRUPT_T parameter structure that has been
885 initialized by the caller.
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
889 Description: This call forces the network adapter to generate an interrupt. When a receive interrupt occurs, the
890 network adapter driver usually queues the packet and calls the application's callback receive
891 routine with a pointer to the packet received. Then, the callback routine either can copy the packet
892 to its buffer or can decide to delay the copy to a later time. If the packet is not immediately copied,
893 the network adapter driver does not remove it from the input queue. When the application wants to
894 copy the packet, it can call the PXENV_UNDI_FORCE_INTERRUPT routine to simulate the receive
898 } PXENV_UNDI_FORCE_INTERRUPT_T;
899 Set before calling API service
901 Returned from API service
902 Status: See the PXENV_STATUS_xxx constants.
904 @param SimpleNetworkDevice Device instance
905 @param PxeUndiTable Point to structure which hold parameter and return value
908 @return Return value of PXE option ROM far call.
911 PxeUndiForceInterrupt (
912 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
913 IN OUT PXENV_UNDI_FORCE_INTERRUPT_T
*PxeUndiTable
919 sizeof (PXENV_UNDI_FORCE_INTERRUPT_T
),
920 PXENV_UNDI_FORCE_INTERRUPT
926 UNDI GET MULTICAST ADDRESS
927 Op-Code: PXENV_UNDI_GET_MCAST_ADDRESS (0011h)
928 Input: Far pointer to a PXENV_GET_MCAST_ADDRESS_t parameter structure that has been initialized
930 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
931 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
933 Description: This call converts the given IP multicast address to a hardware multicast address.
938 } PXENV_UNDI_GET_MCAST_ADDR_T;
939 Set before calling API service
940 InetAddr: IP multicast address.
941 Returned from API service
942 Status: See the PXENV_STATUS_xxx constants.
943 MediaAddr: MAC multicast address.
945 @param SimpleNetworkDevice Device instance
946 @param PxeUndiTable Point to structure which hold parameter and return value
949 @return Return value of PXE option ROM far call.
952 PxeUndiGetMcastAddr (
953 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
954 IN OUT PXENV_UNDI_GET_MCAST_ADDR_T
*PxeUndiTable
960 sizeof (PXENV_UNDI_GET_MCAST_ADDR_T
),
961 PXENV_UNDI_GET_MCAST_ADDR
968 Op-Code: PXENV_UNDI_GET_NIC_TYPE (0012h)
969 Input: Far pointer to a PXENV_UNDI_GET_NIC_TYPE parameter structure that has been initialized by
971 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
972 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
973 constants. If the PXENV_EXIT_SUCCESS is returned the parameter structure must contain the
975 Description: This call, if successful, provides the NIC-specific information necessary to identify the network
976 adapter that is used to boot the system.
977 Note: The application first gets the DHCPDISCOVER packet using GET_CACHED_INFO and checks if
978 the UNDI is supported before making this call. If the UNDI is not supported, the NIC-specific
979 information can be obtained from the DHCPDISCOVER packet itself.
980 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called
981 before the information provided is valid.
987 #define CardBus_NIC 4
1008 } PXENV_UNDI_GET_NIC_TYPE_T;
1009 Set before calling API service
1011 Returned from API service
1012 Status: See the PXENV_STATUS_xxx constants.
1013 NICType: Type of NIC information stored in the parameter
1015 Info: Information about the fields in this union can be found
1016 in the [PnP] and [PCI] specifications
1018 @param SimpleNetworkDevice Device instance
1019 @param PxeUndiTable Point to structure which hold parameter and return value
1020 for option ROM call.
1022 @return Return value of PXE option ROM far call.
1026 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
1027 IN OUT PXENV_UNDI_GET_NIC_TYPE_T
*PxeUndiTable
1030 return MakePxeCall (
1031 SimpleNetworkDevice
,
1033 sizeof (PXENV_UNDI_GET_NIC_TYPE_T
),
1034 PXENV_UNDI_GET_NIC_TYPE
1041 Op-Code: PXENV_UNDI_GET_IFACE_INFO (0013h)
1042 Input: Far pointer to a PXENV_UNDI_GET_IFACE_INFO_t parameter structure that has been initialized
1044 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1045 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1046 constants. If the PXENV_EXIT_SUCCESS is returned, the parameter structure must contain the
1047 interface specific information.
1048 Description: This call, if successful, provides the network interface specific information such as the interface
1049 type at the link layer (Ethernet, Tokenring) and the link speed. This information can be used in the
1050 universal drivers such as NDIS or Miniport to communicate to the upper protocol modules.
1051 Note: UNDI follows the NDIS2 specification in giving this information. It is the responsibility of the
1052 universal driver to translate/convert this information into a format that is required in its specification
1053 or to suit the expectation of the upper level protocol modules.
1054 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called
1055 before the information provided is valid.
1058 UINT8 IfaceType[16];
1060 UINT32 ServiceFlags;
1062 } PXENV_UNDI_GET_NDIS_INFO_T;
1063 Set before calling API service
1065 Returned from API service
1066 Status: See the PXENV_STATUS_xxx constants.
1067 IfaceType: Name of MAC type in ASCIIZ format. This is
1068 used by the universal NDIS driver to specify its driver type
1069 to the protocol driver.
1070 LinkSpeed: Defined in the NDIS 2.0 specification.
1071 ServiceFlags: Defined in the NDIS 2.0 specification.
1072 Reserved: Must be zero.
1074 @param SimpleNetworkDevice Device instance
1075 @param PxeUndiTable Point to structure which hold parameter and return value
1076 for option ROM call.
1078 @return Return value of PXE option ROM far call.
1081 PxeUndiGetNdisInfo (
1082 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
1083 IN OUT PXENV_UNDI_GET_NDIS_INFO_T
*PxeUndiTable
1086 return MakePxeCall (
1087 SimpleNetworkDevice
,
1089 sizeof (PXENV_UNDI_GET_NDIS_INFO_T
),
1090 PXENV_UNDI_GET_NDIS_INFO
1097 Op-Code: PXENV_UNDI_ISR (0014h)
1098 Input: Far pointer to a PXENV_UNDI_ISR_T parameter structure that has been initialized by the caller.
1099 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1100 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1102 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in
1103 the parameter block indicates the operation to be performed for the call. This field is filled with the
1104 status of that operation on return.
1105 Note: Interrupt Service Routine Operation:
1106 In this design the UNDI does not hook the interrupt for the Network Interface. Instead, the
1107 application or the protocol driver hooks the interrupt and calls UNDI with the PXENV_UNDI_ISR
1108 API call for interrupt verification (PXENV_UNDI_ISR_IN_START) and processing
1109 (PXENV_UNDI_ISR_IN_PROCESS and PXENV_UNDI_ISR_GET_NEXT).
1110 When the Network Interface HW generates an interrupt the protocol driver interrupt service
1111 routine (ISR) gets control and takes care of the interrupt processing at the PIC level. The ISR then
1112 calls the UNDI using the PXENV_UNDI_ISR API with the value PXENV_UNDI_ISR_IN_START for
1113 the FuncFlag parameter. At this time UNDI must disable the interrupts at the Network Interface
1114 level and read any status values required to further process the interrupt. UNDI must return as
1115 quickly as possible with one of the two values, PXENV_UNDI_ISR_OUT_OURS or
1116 PXENV_UNDI_ISR_OUT_NOT_OURS, for the parameter FuncFlag depending on whether the
1117 interrupt was generated by this particular Network Interface or not.
1118 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_NOT_OURS, then the interrupt was
1119 not generated by our NIC, and interrupt processing is complete.
1120 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_OURS, the protocol driver must start
1121 a handler thread and send an end-of-interrupt (EOI) command to the PIC. Interrupt processing is
1123 The protocol driver strategy routine will call UNDI using this same API with FuncFlag equal to
1124 PXENV_UNDI_ISR_IN_PROCESS. At this time UNDI must find the cause of this interrupt and
1125 return the status in the FuncFlag. It first checks if there is a frame received and if so it returns the
1126 first buffer pointer of that frame in the parameter block.
1127 The protocol driver calls UNDI repeatedly with the FuncFlag equal to
1128 PXENV_UNDI_ISR_IN_GET_NEXT to get all the buffers in a frame and also all the received
1129 frames in the queue. On this call, UNDI must remember the previous buffer given to the protoco,l
1130 remove it from the receive queue and recycle it. In case of a multi-buffered frame, if the previous
1131 buffer is not the last buffer in the frame it must return the next buffer in the frame in the parameter
1132 block. Otherwise it must return the first buffer in the next frame.
1133 If there is no received frame pending to be processed, UNDI processes the transmit completes and
1134 if there is no other interrupt status to be processed, UNDI re-enables the interrupt at the
1135 NETWORK INTERFACE level and returns PXENV_UNDI_ISR_OUT_DONE in the FuncFlag.
1136 IMPORTANT: It is possible for the protocol driver to be interrupted again while in the
1137 strategy routine when the UNDI re-enables interrupts.
1139 @param SimpleNetworkDevice Device instance
1140 @param PxeUndiTable Point to structure which hold parameter and return value
1141 for option ROM call.
1143 @return Return value of PXE option ROM far call.
1147 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
1148 IN OUT PXENV_UNDI_ISR_T
*PxeUndiTable
1151 return MakePxeCall (
1152 SimpleNetworkDevice
,
1154 sizeof (PXENV_UNDI_ISR_T
),
1162 Op-Code: PXENV_STOP_UNDI (0015h)
1163 Input: Far pointer to a PXENV_STOP_UNDI_T parameter structure that has been initialized by the caller.
1164 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1165 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1167 Description: This routine is responsible for unhooking the Int 1Ah service routine.
1168 Note: This API service must be called only once at the end of UNDI Option ROM boot. One of the valid
1169 status codes is PXENV_STATUS_KEEP. If this status is returned, UNDI must not be removed from
1170 base memory. Also, UNDI must not be removed from base memory if BC is not removed from base
1172 Service cannot be used in protected mode.
1174 PXENV_STATUS Status;
1175 } PXENV_STOP_UNDI_T;
1176 Set before calling API service
1178 Returned from API service
1179 Status: See the PXENV_STATUS_xxx constants.
1181 @param SimpleNetworkDevice Device instance
1182 @param PxeUndiTable Point to structure which hold parameter and return value
1183 for option ROM call.
1185 @return Return value of PXE option ROM far call.
1189 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
1190 IN OUT PXENV_STOP_UNDI_T
*PxeUndiTable
1193 return MakePxeCall (
1194 SimpleNetworkDevice
,
1196 sizeof (PXENV_STOP_UNDI_T
),
1204 Op-Code: PXENV_UNDI_GET_STATE (0015h)
1205 Input: Far pointer to a PXENV_UNDI_GET_STATE_T parameter.
1206 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1207 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1208 constants. The UNDI_STATE field in the parameter structure must be set to one of the valid state
1210 Description: This call can be used to obtain state of the UNDI engine in order to avoid issuing adverse call
1213 #define PXE_UNDI_GET_STATE_STARTED 1
1214 #define PXE_UNDI_GET_STATE_INITIALIZED 2
1215 #define PXE_UNDI_GET_STATE_OPENED 3
1216 PXENV_STATUS Status;
1218 } PXENV_UNDI_GET_STATE_T;
1219 Set before calling API service
1221 Returned from API service
1222 Status: See the PXENV_STATUS_xxx constants.
1223 State: See definitions of the state constants.
1224 Note. UNDI implementation is responsible for maintaining
1225 internal state machine.
1227 Op-Code: PXENV_UNDI_ISR (0014h)
1228 Input: Far pointer to a t_PXENV_UNDI_ISR parameter structure that has been initialized by the caller.
1229 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1230 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1232 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in
1233 the parameter block indicates the operation to be performed for the call. This field is filled with the
1234 status of that operation on return.
1236 @param SimpleNetworkDevice Device instance
1237 @param PxeUndiTable Point to structure which hold parameter and return value
1238 for option ROM call.
1240 @return Return value of PXE option ROM far call.
1244 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
1245 IN OUT PXENV_UNDI_GET_STATE_T
*PxeUndiTable
1248 return MakePxeCall (
1249 SimpleNetworkDevice
,
1251 sizeof (PXENV_UNDI_GET_STATE_T
),
1252 PXENV_UNDI_GET_STATE