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
;
571 UNDI SET STATION ADDRESS
572 Op-Code: PXENV_UNDI_SET_STATION_ADDRESS (000Ah)
573 Input: Far pointer to a PXENV_UNDI_SET_STATION_ADDRESS_t parameter structure that has been
574 initialized by the caller.
575 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
576 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
578 Description: This call sets the MAC address to be the input value and is called before opening the network
579 adapter. Later, the open call uses this variable as a temporary MAC address to program the
580 adapter individual address registers.
583 MAC_ADDR StationAddress;
584 } PXENV_UNDI_SET_STATION_ADDR_T;
585 Set before calling API service
586 StationAddress: Temporary MAC address to be used for
587 transmit and receive.
588 Returned from API service
589 Status: See the PXENV_STATUS_xxx constants.
591 @param SimpleNetworkDevice Device instance
592 @param PxeUndiTable Point to structure which hold parameter and return value
595 @return Return value of PXE option ROM far call.
598 PxeUndiSetStationAddr (
599 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
600 IN OUT PXENV_UNDI_SET_STATION_ADDR_T
*PxeUndiTable
606 sizeof (PXENV_UNDI_SET_STATION_ADDR_T
),
607 PXENV_UNDI_SET_STATION_ADDR
613 UNDI SET PACKET FILTER
614 Op-Code: PXENV_UNDI_SET_PACKET_FILTER (000Bh)
615 Input: Far pointer to a PXENV_UNDI_SET_PACKET_FILTER_T parameter structure that has been
616 initialized by the caller.
617 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
618 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
620 Description: This call resets the adapter's receive unit to accept a new filter, different from the one provided with
625 } PXENV_UNDI_SET_PACKET_FILTER_T;
626 Set before calling API service
627 Filter: See the receive filter values in the UNDI OPEN
628 (0006h) API description.
629 Returned from API service
630 Status: See the PXENV_STATUS_xxx constants.
632 @param SimpleNetworkDevice Device instance
633 @param PxeUndiTable Point to structure which hold parameter and return value
636 @return Return value of PXE option ROM far call.
642 Op-Code: PXENV_UNDI_GET_INFORMATION (000Ch)
643 Input: Far pointer to a PXENV_UNDI_GET_INFORMATION_T parameter structure that has been
644 initialized by the caller.
645 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
646 the parameter structure must be set to one of the values represented by the
647 PXENV_STATUS_xxx constants.
648 Description: This call copies the network adapter variables, including the MAC address, into the input buffer.
649 Note: The PermNodeAddress field must be valid after PXENV_START_UNDI and
650 PXENV_UNDI_STARTUP have been issued. All other fields must be valid after
651 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE have been
660 #define EXP_ETHER_TYPE 2
662 #define ARCNET_TYPE 7
664 MAC_ADDR CurrentNodeAddress;
665 MAC_ADDR PermNodeAddress;
669 } PXENV_UNDI_GET_INFORMATION_T;
670 Set before calling API service
672 Returned from API service
673 Status: See the PXENV_STATUS_xxx constants.
674 BaseIO: Adapter base I/O address.
675 IntNumber: Adapter IRQ number.
676 MaxTranUnit: Adapter maximum transmit unit.
677 HWType: Type of protocol at the hardware level.
678 HWAddrLen: Length of the hardware address.
679 CurrentNodeAddress: Current hardware address.
680 PermNodeAddress: Permanent hardware address.
681 ROMAddress: Real mode ROM segment address.
682 RxBufCnt: Receive queue length.
683 TxBufCnt: Transmit queue length.
685 @param SimpleNetworkDevice Device instance
686 @param PxeUndiTable Point to structure which hold parameter and return value
689 @return Return value of PXE option ROM far call.
692 PxeUndiGetInformation (
693 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
694 IN OUT PXENV_UNDI_GET_INFORMATION_T
*PxeUndiTable
700 sizeof (PXENV_UNDI_GET_INFORMATION_T
),
701 PXENV_UNDI_GET_INFORMATION
708 Op-Code: PXENV_UNDI_GET_STATISTICS (000Dh)
709 Input: Far pointer to a PXENV_UNDI_GET_STATISTICS_T parameter structure that has been initialized
711 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
712 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
714 Description: This call reads statistical information from the network adapter, and returns.
717 UINT32 XmtGoodFrames;
718 UINT32 RcvGoodFrames;
720 UINT32 RcvResourceErrors;
721 } PXENV_UNDI_GET_STATISTICS_T;
722 Set before calling API service
724 Returned from API service
725 Status: See the PXENV_STATUS_xxx constants.
726 XmtGoodFrames: Number of successful transmissions.
727 RcvGoodFrames: Number of good frames received.
728 RcvCRCErrors: Number of frames received with CRC
730 RcvResourceErrors: Number of frames discarded
731 because receive queue was full.
733 @param SimpleNetworkDevice Device instance
734 @param PxeUndiTable Point to structure which hold parameter and return value
737 @return Return value of PXE option ROM far call.
740 PxeUndiGetStatistics (
741 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
742 IN OUT PXENV_UNDI_GET_STATISTICS_T
*PxeUndiTable
748 sizeof (PXENV_UNDI_GET_STATISTICS_T
),
749 PXENV_UNDI_GET_STATISTICS
755 UNDI CLEAR STATISTICS
756 Op-Code: PXENV_UNDI_CLEAR_STATISTICS (000Eh)
757 Input: Far pointer to a PXENV_UNDI_CLEAR_STATISTICS_T parameter.
758 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
759 the parameter structure must be set to one of the values represented by the
760 PXENV_STATUS_xxx constants.
761 Description: This call clears the statistical information from the network adapter.
764 } PXENV_UNDI_CLEAR_STATISTICS_T;
765 Set before calling API service
767 Returned from API service
768 Status: See the PXENV_STATUS_xxx constants.
770 @param SimpleNetworkDevice Device instance
771 @param PxeUndiTable Point to structure which hold parameter and return value
774 @return Return value of PXE option ROM far call.
777 PxeUndiClearStatistics (
778 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
779 IN OUT PXENV_UNDI_CLEAR_STATISTICS_T
*PxeUndiTable
785 sizeof (PXENV_UNDI_CLEAR_STATISTICS_T
),
786 PXENV_UNDI_CLEAR_STATISTICS
793 Op-Code: PXENV_UNDI_INITIATE_DIAGS (000Fh)
794 Input: Far pointer to a PXENV_UNDI_INITIATE_DIAGS_T parameter.
795 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
796 the parameter structure must be set to one of the values represented by the
797 PXENV_STATUS_xxx constants.
798 Description: This call can be used to initiate the run-time diagnostics. It causes the network adapter to run
799 hardware diagnostics and to update its status information.
802 } PXENV_UNDI_INITIATE_DIAGS_T;
803 Set before calling API service
805 Returned from API service
806 Status: See the PXENV_STATUS_xxx constants.
808 @param SimpleNetworkDevice Device instance
809 @param PxeUndiTable Point to structure which hold parameter and return value
812 @return Return value of PXE option ROM far call.
818 Op-Code: PXENV_UNDI_FORCE_INTERRUPT (0010h)
819 Input: Far pointer to a PXENV_UNDI_FORCE_INTERRUPT_T parameter structure that has been
820 initialized by the caller.
821 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
822 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
824 Description: This call forces the network adapter to generate an interrupt. When a receive interrupt occurs, the
825 network adapter driver usually queues the packet and calls the application's callback receive
826 routine with a pointer to the packet received. Then, the callback routine either can copy the packet
827 to its buffer or can decide to delay the copy to a later time. If the packet is not immediately copied,
828 the network adapter driver does not remove it from the input queue. When the application wants to
829 copy the packet, it can call the PXENV_UNDI_FORCE_INTERRUPT routine to simulate the receive
833 } PXENV_UNDI_FORCE_INTERRUPT_T;
834 Set before calling API service
836 Returned from API service
837 Status: See the PXENV_STATUS_xxx constants.
839 @param SimpleNetworkDevice Device instance
840 @param PxeUndiTable Point to structure which hold parameter and return value
843 @return Return value of PXE option ROM far call.
848 UNDI GET MULTICAST ADDRESS
849 Op-Code: PXENV_UNDI_GET_MCAST_ADDRESS (0011h)
850 Input: Far pointer to a PXENV_GET_MCAST_ADDRESS_t parameter structure that has been initialized
852 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
853 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
855 Description: This call converts the given IP multicast address to a hardware multicast address.
860 } PXENV_UNDI_GET_MCAST_ADDR_T;
861 Set before calling API service
862 InetAddr: IP multicast address.
863 Returned from API service
864 Status: See the PXENV_STATUS_xxx constants.
865 MediaAddr: MAC multicast address.
867 @param SimpleNetworkDevice Device instance
868 @param PxeUndiTable Point to structure which hold parameter and return value
871 @return Return value of PXE option ROM far call.
874 PxeUndiGetMcastAddr (
875 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
876 IN OUT PXENV_UNDI_GET_MCAST_ADDR_T
*PxeUndiTable
882 sizeof (PXENV_UNDI_GET_MCAST_ADDR_T
),
883 PXENV_UNDI_GET_MCAST_ADDR
890 Op-Code: PXENV_UNDI_GET_NIC_TYPE (0012h)
891 Input: Far pointer to a PXENV_UNDI_GET_NIC_TYPE parameter structure that has been initialized by
893 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
894 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
895 constants. If the PXENV_EXIT_SUCCESS is returned the parameter structure must contain the
897 Description: This call, if successful, provides the NIC-specific information necessary to identify the network
898 adapter that is used to boot the system.
899 Note: The application first gets the DHCPDISCOVER packet using GET_CACHED_INFO and checks if
900 the UNDI is supported before making this call. If the UNDI is not supported, the NIC-specific
901 information can be obtained from the DHCPDISCOVER packet itself.
902 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called
903 before the information provided is valid.
909 #define CardBus_NIC 4
930 } PXENV_UNDI_GET_NIC_TYPE_T;
931 Set before calling API service
933 Returned from API service
934 Status: See the PXENV_STATUS_xxx constants.
935 NICType: Type of NIC information stored in the parameter
937 Info: Information about the fields in this union can be found
938 in the [PnP] and [PCI] specifications
940 @param SimpleNetworkDevice Device instance
941 @param PxeUndiTable Point to structure which hold parameter and return value
944 @return Return value of PXE option ROM far call.
948 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
949 IN OUT PXENV_UNDI_GET_NIC_TYPE_T
*PxeUndiTable
955 sizeof (PXENV_UNDI_GET_NIC_TYPE_T
),
956 PXENV_UNDI_GET_NIC_TYPE
963 Op-Code: PXENV_UNDI_GET_IFACE_INFO (0013h)
964 Input: Far pointer to a PXENV_UNDI_GET_IFACE_INFO_t parameter structure that has been initialized
966 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
967 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
968 constants. If the PXENV_EXIT_SUCCESS is returned, the parameter structure must contain the
969 interface specific information.
970 Description: This call, if successful, provides the network interface specific information such as the interface
971 type at the link layer (Ethernet, Tokenring) and the link speed. This information can be used in the
972 universal drivers such as NDIS or Miniport to communicate to the upper protocol modules.
973 Note: UNDI follows the NDIS2 specification in giving this information. It is the responsibility of the
974 universal driver to translate/convert this information into a format that is required in its specification
975 or to suit the expectation of the upper level protocol modules.
976 PXENV_START_UNDI, PXENV_UNDI_STARTUP and PXENV_UNDI_INITIALIZE must be called
977 before the information provided is valid.
984 } PXENV_UNDI_GET_NDIS_INFO_T;
985 Set before calling API service
987 Returned from API service
988 Status: See the PXENV_STATUS_xxx constants.
989 IfaceType: Name of MAC type in ASCIIZ format. This is
990 used by the universal NDIS driver to specify its driver type
991 to the protocol driver.
992 LinkSpeed: Defined in the NDIS 2.0 specification.
993 ServiceFlags: Defined in the NDIS 2.0 specification.
994 Reserved: Must be zero.
996 @param SimpleNetworkDevice Device instance
997 @param PxeUndiTable Point to structure which hold parameter and return value
1000 @return Return value of PXE option ROM far call.
1003 PxeUndiGetNdisInfo (
1004 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
1005 IN OUT PXENV_UNDI_GET_NDIS_INFO_T
*PxeUndiTable
1008 return MakePxeCall (
1009 SimpleNetworkDevice
,
1011 sizeof (PXENV_UNDI_GET_NDIS_INFO_T
),
1012 PXENV_UNDI_GET_NDIS_INFO
1019 Op-Code: PXENV_UNDI_ISR (0014h)
1020 Input: Far pointer to a PXENV_UNDI_ISR_T parameter structure that has been initialized by the caller.
1021 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1022 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1024 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in
1025 the parameter block indicates the operation to be performed for the call. This field is filled with the
1026 status of that operation on return.
1027 Note: Interrupt Service Routine Operation:
1028 In this design the UNDI does not hook the interrupt for the Network Interface. Instead, the
1029 application or the protocol driver hooks the interrupt and calls UNDI with the PXENV_UNDI_ISR
1030 API call for interrupt verification (PXENV_UNDI_ISR_IN_START) and processing
1031 (PXENV_UNDI_ISR_IN_PROCESS and PXENV_UNDI_ISR_GET_NEXT).
1032 When the Network Interface HW generates an interrupt the protocol driver interrupt service
1033 routine (ISR) gets control and takes care of the interrupt processing at the PIC level. The ISR then
1034 calls the UNDI using the PXENV_UNDI_ISR API with the value PXENV_UNDI_ISR_IN_START for
1035 the FuncFlag parameter. At this time UNDI must disable the interrupts at the Network Interface
1036 level and read any status values required to further process the interrupt. UNDI must return as
1037 quickly as possible with one of the two values, PXENV_UNDI_ISR_OUT_OURS or
1038 PXENV_UNDI_ISR_OUT_NOT_OURS, for the parameter FuncFlag depending on whether the
1039 interrupt was generated by this particular Network Interface or not.
1040 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_NOT_OURS, then the interrupt was
1041 not generated by our NIC, and interrupt processing is complete.
1042 If the value returned in FuncFlag is PXENV_UNDI_ISR_OUT_OURS, the protocol driver must start
1043 a handler thread and send an end-of-interrupt (EOI) command to the PIC. Interrupt processing is
1045 The protocol driver strategy routine will call UNDI using this same API with FuncFlag equal to
1046 PXENV_UNDI_ISR_IN_PROCESS. At this time UNDI must find the cause of this interrupt and
1047 return the status in the FuncFlag. It first checks if there is a frame received and if so it returns the
1048 first buffer pointer of that frame in the parameter block.
1049 The protocol driver calls UNDI repeatedly with the FuncFlag equal to
1050 PXENV_UNDI_ISR_IN_GET_NEXT to get all the buffers in a frame and also all the received
1051 frames in the queue. On this call, UNDI must remember the previous buffer given to the protoco,l
1052 remove it from the receive queue and recycle it. In case of a multi-buffered frame, if the previous
1053 buffer is not the last buffer in the frame it must return the next buffer in the frame in the parameter
1054 block. Otherwise it must return the first buffer in the next frame.
1055 If there is no received frame pending to be processed, UNDI processes the transmit completes and
1056 if there is no other interrupt status to be processed, UNDI re-enables the interrupt at the
1057 NETWORK INTERFACE level and returns PXENV_UNDI_ISR_OUT_DONE in the FuncFlag.
1058 IMPORTANT: It is possible for the protocol driver to be interrupted again while in the
1059 strategy routine when the UNDI re-enables interrupts.
1061 @param SimpleNetworkDevice Device instance
1062 @param PxeUndiTable Point to structure which hold parameter and return value
1063 for option ROM call.
1065 @return Return value of PXE option ROM far call.
1069 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
1070 IN OUT PXENV_UNDI_ISR_T
*PxeUndiTable
1073 return MakePxeCall (
1074 SimpleNetworkDevice
,
1076 sizeof (PXENV_UNDI_ISR_T
),
1084 Op-Code: PXENV_STOP_UNDI (0015h)
1085 Input: Far pointer to a PXENV_STOP_UNDI_T parameter structure that has been initialized by the caller.
1086 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1087 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1089 Description: This routine is responsible for unhooking the Int 1Ah service routine.
1090 Note: This API service must be called only once at the end of UNDI Option ROM boot. One of the valid
1091 status codes is PXENV_STATUS_KEEP. If this status is returned, UNDI must not be removed from
1092 base memory. Also, UNDI must not be removed from base memory if BC is not removed from base
1094 Service cannot be used in protected mode.
1096 PXENV_STATUS Status;
1097 } PXENV_STOP_UNDI_T;
1098 Set before calling API service
1100 Returned from API service
1101 Status: See the PXENV_STATUS_xxx constants.
1103 @param SimpleNetworkDevice Device instance
1104 @param PxeUndiTable Point to structure which hold parameter and return value
1105 for option ROM call.
1107 @return Return value of PXE option ROM far call.
1111 IN EFI_SIMPLE_NETWORK_DEV
*SimpleNetworkDevice
,
1112 IN OUT PXENV_STOP_UNDI_T
*PxeUndiTable
1115 return MakePxeCall (
1116 SimpleNetworkDevice
,
1118 sizeof (PXENV_STOP_UNDI_T
),
1126 Op-Code: PXENV_UNDI_GET_STATE (0015h)
1127 Input: Far pointer to a PXENV_UNDI_GET_STATE_T parameter.
1128 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1129 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1130 constants. The UNDI_STATE field in the parameter structure must be set to one of the valid state
1132 Description: This call can be used to obtain state of the UNDI engine in order to avoid issuing adverse call
1135 #define PXE_UNDI_GET_STATE_STARTED 1
1136 #define PXE_UNDI_GET_STATE_INITIALIZED 2
1137 #define PXE_UNDI_GET_STATE_OPENED 3
1138 PXENV_STATUS Status;
1140 } PXENV_UNDI_GET_STATE_T;
1141 Set before calling API service
1143 Returned from API service
1144 Status: See the PXENV_STATUS_xxx constants.
1145 State: See definitions of the state constants.
1146 Note. UNDI implementation is responsible for maintaining
1147 internal state machine.
1149 Op-Code: PXENV_UNDI_ISR (0014h)
1150 Input: Far pointer to a t_PXENV_UNDI_ISR parameter structure that has been initialized by the caller.
1151 Output: PXENV_EXIT_SUCCESS or PXENV_EXIT_FAILURE must be returned in AX. The status field in
1152 the parameter structure must be set to one of the values represented by the PXENV_STATUS_xxx
1154 Description: This API function will be called at different levels of processing the interrupt. The FuncFlag field in
1155 the parameter block indicates the operation to be performed for the call. This field is filled with the
1156 status of that operation on return.
1158 @param SimpleNetworkDevice Device instance
1159 @param PxeUndiTable Point to structure which hold parameter and return value
1160 for option ROM call.
1162 @return Return value of PXE option ROM far call.