Home | History | Annotate | Download | only in Snp16Dxe
      1 /** @file
      2   Wrapper routines that use a PXE-enabled NIC option ROM to
      3   supply internal routines for an EFI SNI (Simple Network
      4   Interface) Protocol.
      5 
      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
      9 
     10   http://developer.intel.com/ial/wfm/wfmspecs.htm
     11 
     12 Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
     13 
     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
     19 
     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.
     22 
     23 **/
     24 
     25 #include "BiosSnp16.h"
     26 
     27 /**
     28   PXE
     29   START UNDI
     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
     34   constants.
     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.
     42   typedef struct  {
     43       PXENV_STATUS Status;
     44       UINT16 AX;
     45       UINT16 BX;
     46       UINT16 DX;
     47       UINT16 DI;
     48       UINT16 ES;
     49   } PXENV_START_UNDI_T;
     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
     55   [BBS] specifications.
     56   Returned from API service
     57   Status: See the PXENV_STATUS_xxx constants.
     58 
     59   @param  SimpleNetworkDevice   Device instance
     60   @param  PxeUndiTable          Point to structure which hold paramter and return value
     61                                 for option ROM call.
     62 
     63   @return Return value of PXE option ROM far call.
     64 **/
     65 EFI_STATUS
     66 PxeStartUndi (
     67   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
     68   IN OUT PXENV_START_UNDI_T      *PxeUndiTable
     69   )
     70 {
     71   return MakePxeCall (
     72           SimpleNetworkDevice,
     73           PxeUndiTable,
     74           sizeof (PXENV_START_UNDI_T),
     75           PXENV_START_UNDI
     76           );
     77 }
     78 
     79 /**
     80   PXE
     81   UNDI STARTUP
     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
     84   caller.
     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
     91   been completed.
     92   Note: PXENV_UNDI_STARTUP must not be called again without first calling
     93   PXENV_UNDI_SHUTDOWN.
     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.
     98   typedef struct
     99   {
    100       PXENV_STATUS Status;
    101   } PXENV_UNDI_STARTUP_T;
    102   Set before calling API service
    103   N/A
    104   Returned from API service
    105   Status: See the PXENV_STATUS_xxx constants.
    106 
    107   @param  SimpleNetworkDevice   Device instance
    108   @param  PxeUndiTable          Point to structure which hold paramter and return value
    109                                 for option ROM call.
    110 
    111   @return Return value of PXE option ROM far call.
    112 **/
    113 EFI_STATUS
    114 PxeUndiStartup (
    115   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
    116   IN OUT PXENV_UNDI_STARTUP_T    *PxeUndiTable
    117   )
    118 {
    119   return MakePxeCall (
    120           SimpleNetworkDevice,
    121           PxeUndiTable,
    122           sizeof (PXENV_UNDI_STARTUP_T),
    123           PXENV_UNDI_STARTUP
    124           );
    125 }
    126 
    127 /**
    128   PXE
    129   UNDI CLEANUP
    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.
    139   typedef struct {
    140       PXENX_STATUS Status;
    141   } PXENV_UNDI_CLEANUP_T;
    142   Set before calling API service
    143   N/A
    144   Returned from API service
    145   Status: See the PXENV_STATUS_xxx constants.
    146 
    147   @param  SimpleNetworkDevice   Device instance
    148   @param  PxeUndiTable          Point to structure which hold paramter and return value
    149                                 for option ROM call.
    150 
    151   @return Return value of PXE option ROM far call.
    152 **/
    153 EFI_STATUS
    154 PxeUndiCleanup (
    155   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
    156   IN OUT PXENV_UNDI_CLEANUP_T    *PxeUndiTable
    157   )
    158 {
    159   return MakePxeCall (
    160           SimpleNetworkDevice,
    161           PxeUndiTable,
    162           sizeof (PXENV_UNDI_CLEANUP_T),
    163           PXENV_UNDI_CLEANUP
    164           );
    165 }
    166 
    167 /**
    168   PXE
    169   UNDI INITIALIZE
    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
    172   caller.
    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
    175   constants.
    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.
    183   typedef struct {
    184     PXENV_STATUS Status;
    185     ADDR32 ProtocolIni;
    186     UINT8 reserved[8];
    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.
    199 
    200   @param  SimpleNetworkDevice   Device instance
    201   @param  PxeUndiTable          Point to structure which hold paramter and return value
    202                                 for option ROM call.
    203 
    204   @return Return value of PXE option ROM far call.
    205 **/
    206 EFI_STATUS
    207 PxeUndiInitialize (
    208   IN     EFI_SIMPLE_NETWORK_DEV   *SimpleNetworkDevice,
    209   IN OUT PXENV_UNDI_INITIALIZE_T  *PxeUndiTable
    210   )
    211 {
    212   return MakePxeCall (
    213           SimpleNetworkDevice,
    214           PxeUndiTable,
    215           sizeof (PXENV_UNDI_INITIALIZE_T),
    216           PXENV_UNDI_INITIALIZE
    217           );
    218 }
    219 
    220 /**
    221   Wrapper routine for reset adapter.
    222 
    223   PXE
    224   UNDI 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
    227   by the caller.
    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
    230   constants.
    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.
    234   typedef struct {
    235     PXENV_STATUS Status;
    236     PXENV_UNDI_MCAST_ADDRESS_t    R_Mcast_Buf;
    237   } PXENV_UNDI_RESET_T;
    238 
    239   #define MAXNUM_MCADDR 8
    240 
    241   typedef struct {
    242     UINT16 MCastAddrCount;
    243     MAC_ADDR McastAddr[MAXNUM_MCADDR];
    244   } PXENV_UNDI_MCAST_ADDRESS_t;
    245 
    246   Set before calling API service
    247   R_Mcast_Buf: This is a structure of MCastAddrCount and
    248   McastAddr.
    249   MCastAddrCount: Number of multicast MAC addresses in the
    250   buffer.
    251   McastAddr: List of up to MAXNUM_MCADDR multicast MAC
    252   addresses.
    253   Returned from API service
    254   Status: See the PXENV_STATUS_xxx constants.
    255 
    256   @param  SimpleNetworkDevice   Device instance.
    257   @param  PxeUndiTable          Point to structure which hold paramter and return value
    258                                 for option ROM call.
    259   @param  RxFilter             Filter setting mask value for PXE recive .
    260 
    261   @return Return value of PXE option ROM far call.
    262 **/
    263 EFI_STATUS
    264 PxeUndiResetNic (
    265   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
    266   IN OUT PXENV_UNDI_RESET_T      *PxeUndiTable,
    267   IN     UINT16                  RxFilter
    268   )
    269 {
    270   PXENV_UNDI_OPEN_T   Open;
    271   PXENV_UNDI_CLOSE_T  Close;
    272   UINTN               Status;
    273 
    274   Status = MakePxeCall (
    275             SimpleNetworkDevice,
    276             PxeUndiTable,
    277             sizeof (PXENV_UNDI_RESET_T),
    278             PXENV_UNDI_RESET_NIC
    279             );
    280   if (!EFI_ERROR(Status)) {
    281     return Status;
    282   }
    283 
    284   Close.Status = PXENV_STATUS_SUCCESS;
    285 
    286   Status = MakePxeCall (
    287             SimpleNetworkDevice,
    288             &Close,
    289             sizeof (Close),
    290             PXENV_UNDI_CLOSE
    291             );
    292   if (EFI_ERROR(Status)) {
    293     return EFI_DEVICE_ERROR;
    294   }
    295 
    296   Status = MakePxeCall (
    297             SimpleNetworkDevice,
    298             PxeUndiTable,
    299             sizeof (PXENV_UNDI_RESET_T),
    300             PXENV_UNDI_RESET_NIC
    301             );
    302   if (EFI_ERROR(Status)) {
    303     return EFI_DEVICE_ERROR;
    304   }
    305 
    306   Open.Status       = PXENV_STATUS_SUCCESS;
    307   Open.OpenFlag     = 0;
    308   Open.PktFilter    = RxFilter;
    309   CopyMem (
    310     &Open.McastBuffer,
    311     &PxeUndiTable->R_Mcast_Buf,
    312     sizeof (PXENV_UNDI_MCAST_ADDR_T)
    313     );
    314 
    315 
    316   Status = MakePxeCall (
    317             SimpleNetworkDevice,
    318             &Open,
    319             sizeof (Open),
    320             PXENV_UNDI_OPEN
    321             );
    322   if (EFI_ERROR(Status)) {
    323     return EFI_DEVICE_ERROR;
    324   }
    325 
    326   return EFI_SUCCESS;
    327 }
    328 
    329 /**
    330   PXE
    331   UNDI SHUTDOWN
    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
    336   constants.
    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.
    340   typedef struct
    341   {
    342     PXENV_STATUS Status;
    343   } PXENV_UNDI_SHUTDOWN_T;
    344   Set before calling API service
    345   N/A
    346   Returned from API service
    347   Status: See the PXENV_STATUS_xxx constants.
    348 
    349   @param  SimpleNetworkDevice   Device instance
    350   @param  PxeUndiTable          Point to structure which hold paramter and return value
    351                                 for option ROM call.
    352 
    353   @return Return value of PXE option ROM far call.
    354 **/
    355 EFI_STATUS
    356 PxeUndiShutdown (
    357   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
    358   IN OUT PXENV_UNDI_SHUTDOWN_T   *PxeUndiTable
    359   )
    360 {
    361   return MakePxeCall (
    362           SimpleNetworkDevice,
    363           PxeUndiTable,
    364           sizeof (PXENV_UNDI_SHUTDOWN_T),
    365           PXENV_UNDI_SHUTDOWN
    366           );
    367 }
    368 
    369 /**
    370   PXE
    371   UNDI OPEN
    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
    376   constants.
    377   Description: This call activates the adapter network connection and sets the adapter ready to accept packets
    378   for transmit and receive.
    379   typedef struct {
    380     PXENV_STATUS Status;
    381     UINT16 OpenFlag;
    382     UINT16 PktFilter;
    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;
    388   } PXENV_UNDI_OPEN_T;
    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.)
    393   This can be zero.
    394   PktFilter: Filter for receiving packets. This can be one, or more, of
    395   the FLTR_xxx constants. Multiple values are arithmetically or-ed
    396   together.
    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.
    402 
    403   @param  SimpleNetworkDevice   Device instance
    404   @param  PxeUndiTable          Point to structure which hold paramter and return value
    405                                 for option ROM call.
    406 
    407   @return Return value of PXE option ROM far call.
    408 **/
    409 EFI_STATUS
    410 PxeUndiOpen (
    411   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
    412   IN OUT PXENV_UNDI_OPEN_T       *PxeUndiTable
    413   )
    414 {
    415   return MakePxeCall (
    416           SimpleNetworkDevice,
    417           PxeUndiTable,
    418           sizeof (PXENV_UNDI_OPEN_T),
    419           PXENV_UNDI_OPEN
    420           );
    421 }
    422 
    423 /**
    424   PXE
    425   UNDI CLOSE
    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
    430   constants.
    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.
    433   typedef struct {
    434     PXENV_STATUS Status;
    435   } PXENV_UNDI_CLOSE_T;
    436   Set before calling API service
    437   N/A
    438   Returned from API service
    439   Status: See the PXENV_STATUS_xxx constants.
    440 
    441   @param  SimpleNetworkDevice   Device instance
    442   @param  PxeUndiTable          Point to structure which hold paramter and return value
    443                                 for option ROM call.
    444 
    445   @return Return value of PXE option ROM far call.
    446 **/
    447 EFI_STATUS
    448 PxeUndiClose (
    449   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
    450   IN OUT PXENV_UNDI_CLOSE_T      *PxeUndiTable
    451   )
    452 {
    453   return MakePxeCall (
    454           SimpleNetworkDevice,
    455           PxeUndiTable,
    456           sizeof (PXENV_UNDI_CLOSE_T),
    457           PXENV_UNDI_CLOSE
    458           );
    459 }
    460 
    461 /**
    462   PXE
    463   UNDI TRANSMIT PACKET
    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.
    480 
    481   typedef struct {
    482     PXENV_STATUS Status;
    483     UINT8 Protocol;
    484       #define P_UNKNOWN 0
    485       #define P_IP 1
    486       #define P_ARP 2
    487       #define P_RARP 3
    488     UINT8 XmitFlag;
    489       #define XMT_DESTADDR 0x0000
    490       #define XMT_BROADCAST 0x0001
    491     SEGOFF16 DestAddr;
    492     SEGOFF16 TBD;
    493     UINT32 Reserved[2];
    494   } t_PXENV_UNDI_TRANSMIT;
    495 
    496   #define MAX_DATA_BLKS 8
    497 
    498   typedef struct {
    499     UINT16 ImmedLength;
    500     SEGOFF16 Xmit;
    501     UINT16 DataBlkCount;
    502     struct DataBlk {
    503       UINT8 TDPtrType;
    504       UINT8 TDRsvdByte;
    505       UINT16 TDDataLen;
    506       SEGOFF16 TDDataPtr;
    507     } DataBlock[MAX_DATA_BLKS];
    508   } PXENV_UNDI_TBD_T
    509 
    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
    517   destination.
    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.
    522   TDPtrType:
    523   0 => 32-bit physical address in TDDataPtr (not supported in this
    524   version of PXE)
    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
    533 
    534   @param  SimpleNetworkDevice   Device instance
    535   @param  PxeUndiTable          Point to structure which hold paramter and return value
    536                                 for option ROM call.
    537 
    538   @return Return value of PXE option ROM far call.
    539 **/
    540 EFI_STATUS
    541 PxeUndiTransmit (
    542   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
    543   IN OUT PXENV_UNDI_TRANSMIT_T   *PxeUndiTable
    544   )
    545 {
    546   EFI_STATUS  Status;
    547 
    548   Status = MakePxeCall (
    549             SimpleNetworkDevice,
    550             PxeUndiTable,
    551             sizeof (PXENV_UNDI_TRANSMIT_T),
    552             PXENV_UNDI_TRANSMIT
    553             );
    554   if (Status == EFI_SUCCESS) {
    555     return EFI_SUCCESS;
    556   }
    557 
    558   switch (PxeUndiTable->Status) {
    559   case PXENV_STATUS_OUT_OF_RESOURCES:
    560     return EFI_NOT_READY;
    561 
    562   default:
    563     return EFI_DEVICE_ERROR;
    564   }
    565 }
    566 
    567 /**
    568   PXE
    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
    575   constants.
    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.
    578   typedef struct {
    579     PXENV_STATUS Status;
    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
    584   (0004h) API.
    585   Returned from API service
    586   Status: See the PXENV_STATUS_xxx constants
    587 
    588   @param  SimpleNetworkDevice   Device instance
    589   @param  PxeUndiTable          Point to structure which hold paramter and return value
    590                                 for option ROM call.
    591 
    592   @return Return value of PXE option ROM far call.
    593 **/
    594 EFI_STATUS
    595 PxeUndiSetMcastAddr (
    596   IN     EFI_SIMPLE_NETWORK_DEV       *SimpleNetworkDevice,
    597   IN OUT PXENV_UNDI_SET_MCAST_ADDR_T  *PxeUndiTable
    598   )
    599 {
    600   return MakePxeCall (
    601           SimpleNetworkDevice,
    602           PxeUndiTable,
    603           sizeof (PXENV_UNDI_SET_MCAST_ADDR_T),
    604           PXENV_UNDI_SET_MCAST_ADDR
    605           );
    606 }
    607 
    608 /**
    609   PXE
    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
    616   constants.
    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.
    620   typedef struct {
    621     PXENV_STATUS Status;
    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.
    629 
    630   @param  SimpleNetworkDevice   Device instance
    631   @param  PxeUndiTable          Point to structure which hold paramter and return value
    632                                 for option ROM call.
    633 
    634   @return Return value of PXE option ROM far call.
    635 **/
    636 EFI_STATUS
    637 PxeUndiSetStationAddr (
    638   IN     EFI_SIMPLE_NETWORK_DEV         *SimpleNetworkDevice,
    639   IN OUT PXENV_UNDI_SET_STATION_ADDR_T  *PxeUndiTable
    640   )
    641 {
    642   return MakePxeCall (
    643           SimpleNetworkDevice,
    644           PxeUndiTable,
    645           sizeof (PXENV_UNDI_SET_STATION_ADDR_T),
    646           PXENV_UNDI_SET_STATION_ADDR
    647           );
    648 }
    649 
    650 /**
    651   PXE
    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
    658   constants.
    659   Description: This call resets the adapter's receive unit to accept a new filter, different from the one provided with
    660   the open call.
    661   typedef struct {
    662     PXENV_STATUS Status;
    663     UINT8 filter;
    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.
    670 
    671   @param  SimpleNetworkDevice   Device instance
    672   @param  PxeUndiTable          Point to structure which hold paramter and return value
    673                                 for option ROM call.
    674 
    675   @return Return value of PXE option ROM far call.
    676 **/
    677 EFI_STATUS
    678 PxeUndiSetPacketFilter (
    679   IN     EFI_SIMPLE_NETWORK_DEV          *SimpleNetworkDevice,
    680   IN OUT PXENV_UNDI_SET_PACKET_FILTER_T  *PxeUndiTable
    681   )
    682 {
    683   return MakePxeCall (
    684           SimpleNetworkDevice,
    685           PxeUndiTable,
    686           sizeof (PXENV_UNDI_SET_PACKET_FILTER_T),
    687           PXENV_UNDI_SET_PACKET_FILTER
    688           );
    689 }
    690 
    691 /**
    692   PXE
    693   UNDI GET INFORMATION
    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
    704   called.
    705   typedef struct {
    706     PXENV_STATUS Status;
    707     UINT16 BaseIo;
    708     UINT16 IntNumber;
    709     UINT16 MaxTranUnit;
    710     UINT16 HwType;
    711       #define ETHER_TYPE 1
    712       #define EXP_ETHER_TYPE 2
    713       #define IEEE_TYPE 6
    714       #define ARCNET_TYPE 7
    715     UINT16 HwAddrLen;
    716     MAC_ADDR CurrentNodeAddress;
    717     MAC_ADDR PermNodeAddress;
    718     SEGSEL ROMAddress;
    719     UINT16 RxBufCt;
    720     UINT16 TxBufCt;
    721   } PXENV_UNDI_GET_INFORMATION_T;
    722   Set before calling API service
    723   N/A
    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.
    736 
    737   @param  SimpleNetworkDevice   Device instance
    738   @param  PxeUndiTable          Point to structure which hold paramter and return value
    739                                 for option ROM call.
    740 
    741   @return Return value of PXE option ROM far call.
    742 **/
    743 EFI_STATUS
    744 PxeUndiGetInformation (
    745   IN     EFI_SIMPLE_NETWORK_DEV        *SimpleNetworkDevice,
    746   IN OUT PXENV_UNDI_GET_INFORMATION_T  *PxeUndiTable
    747   )
    748 {
    749   return MakePxeCall (
    750           SimpleNetworkDevice,
    751           PxeUndiTable,
    752           sizeof (PXENV_UNDI_GET_INFORMATION_T),
    753           PXENV_UNDI_GET_INFORMATION
    754           );
    755 }
    756 
    757 /**
    758   PXE
    759   UNDI GET STATISTICS
    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
    762   by the caller.
    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
    765   constants.
    766   Description: This call reads statistical information from the network adapter, and returns.
    767   typedef struct {
    768     PXENV_STATUS Status;
    769     UINT32 XmtGoodFrames;
    770     UINT32 RcvGoodFrames;
    771     UINT32 RcvCRCErrors;
    772     UINT32 RcvResourceErrors;
    773   } PXENV_UNDI_GET_STATISTICS_T;
    774   Set before calling API service
    775   N/A
    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
    781   error.
    782   RcvResourceErrors: Number of frames discarded
    783   because receive queue was full.
    784 
    785   @param  SimpleNetworkDevice   Device instance
    786   @param  PxeUndiTable          Point to structure which hold paramter and return value
    787                                 for option ROM call.
    788 
    789   @return Return value of PXE option ROM far call.
    790 **/
    791 EFI_STATUS
    792 PxeUndiGetStatistics (
    793   IN     EFI_SIMPLE_NETWORK_DEV       *SimpleNetworkDevice,
    794   IN OUT PXENV_UNDI_GET_STATISTICS_T  *PxeUndiTable
    795   )
    796 {
    797   return MakePxeCall (
    798           SimpleNetworkDevice,
    799           PxeUndiTable,
    800           sizeof (PXENV_UNDI_GET_STATISTICS_T),
    801           PXENV_UNDI_GET_STATISTICS
    802           );
    803 }
    804 
    805 /**
    806   PXE
    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.
    814   typedef struct {
    815     PXENV_STATUS Status;
    816   } PXENV_UNDI_CLEAR_STATISTICS_T;
    817   Set before calling API service
    818   N/A
    819   Returned from API service
    820   Status: See the PXENV_STATUS_xxx constants.
    821 
    822   @param  SimpleNetworkDevice   Device instance
    823   @param  PxeUndiTable          Point to structure which hold paramter and return value
    824                                 for option ROM call.
    825 
    826   @return Return value of PXE option ROM far call.
    827 **/
    828 EFI_STATUS
    829 PxeUndiClearStatistics (
    830   IN     EFI_SIMPLE_NETWORK_DEV         *SimpleNetworkDevice,
    831   IN OUT PXENV_UNDI_CLEAR_STATISTICS_T  *PxeUndiTable
    832   )
    833 {
    834   return MakePxeCall (
    835           SimpleNetworkDevice,
    836           PxeUndiTable,
    837           sizeof (PXENV_UNDI_CLEAR_STATISTICS_T),
    838           PXENV_UNDI_CLEAR_STATISTICS
    839           );
    840 }
    841 
    842 /**
    843   PXE
    844   UNDI INITIATE DIAGS
    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.
    852   typedef struct {
    853     PXENV_STATUS Status;
    854   } PXENV_UNDI_INITIATE_DIAGS_T;
    855   Set before calling API service
    856   N/A
    857   Returned from API service
    858   Status: See the PXENV_STATUS_xxx constants.
    859 
    860   @param  SimpleNetworkDevice   Device instance
    861   @param  PxeUndiTable          Point to structure which hold paramter and return value
    862                                 for option ROM call.
    863 
    864   @return Return value of PXE option ROM far call.
    865 **/
    866 EFI_STATUS
    867 PxeUndiInitiateDiags (
    868   IN     EFI_SIMPLE_NETWORK_DEV       *SimpleNetworkDevice,
    869   IN OUT PXENV_UNDI_INITIATE_DIAGS_T  *PxeUndiTable
    870   )
    871 {
    872   return MakePxeCall (
    873           SimpleNetworkDevice,
    874           PxeUndiTable,
    875           sizeof (PXENV_UNDI_INITIATE_DIAGS_T),
    876           PXENV_UNDI_INITIATE_DIAGS
    877           );
    878 }
    879 
    880 /**
    881   PXE
    882   UNDI FORCE INTERRUPT
    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
    888   constants.
    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
    895   interrupt.
    896   typedef struct {
    897     PXENV_STATUS Status;
    898   } PXENV_UNDI_FORCE_INTERRUPT_T;
    899   Set before calling API service
    900   N/A
    901   Returned from API service
    902   Status: See the PXENV_STATUS_xxx constants.
    903 
    904   @param  SimpleNetworkDevice   Device instance
    905   @param  PxeUndiTable          Point to structure which hold paramter and return value
    906                                 for option ROM call.
    907 
    908   @return Return value of PXE option ROM far call.
    909 **/
    910 EFI_STATUS
    911 PxeUndiForceInterrupt (
    912   IN     EFI_SIMPLE_NETWORK_DEV        *SimpleNetworkDevice,
    913   IN OUT PXENV_UNDI_FORCE_INTERRUPT_T  *PxeUndiTable
    914   )
    915 {
    916   return MakePxeCall (
    917           SimpleNetworkDevice,
    918           PxeUndiTable,
    919           sizeof (PXENV_UNDI_FORCE_INTERRUPT_T),
    920           PXENV_UNDI_FORCE_INTERRUPT
    921           );
    922 }
    923 
    924 /**
    925   PXE
    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
    929   by the caller.
    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
    932   constants.
    933   Description: This call converts the given IP multicast address to a hardware multicast address.
    934   typedef struct  {
    935     PXENV_STATUS Status;
    936     IP4 InetAddr;
    937     MAC_ADDR MediaAddr;
    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.
    944 
    945   @param  SimpleNetworkDevice   Device instance
    946   @param  PxeUndiTable          Point to structure which hold paramter and return value
    947                                 for option ROM call.
    948 
    949   @return Return value of PXE option ROM far call.
    950 **/
    951 EFI_STATUS
    952 PxeUndiGetMcastAddr (
    953   IN     EFI_SIMPLE_NETWORK_DEV       *SimpleNetworkDevice,
    954   IN OUT PXENV_UNDI_GET_MCAST_ADDR_T  *PxeUndiTable
    955   )
    956 {
    957   return MakePxeCall (
    958           SimpleNetworkDevice,
    959           PxeUndiTable,
    960           sizeof (PXENV_UNDI_GET_MCAST_ADDR_T),
    961           PXENV_UNDI_GET_MCAST_ADDR
    962           );
    963 }
    964 
    965 /**
    966   PXE
    967   UNDI GET NIC TYPE
    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
    970   the caller.
    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
    974   NIC information.
    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.
    982   typedef {
    983     PXENV_STATUS Status;
    984     UINT8 NicType;
    985       #define PCI_NIC 2
    986       #define PnP_NIC 3
    987       #define CardBus_NIC 4
    988     Union {
    989       Struct {
    990         UINT16 Vendor_ID;
    991         UINT16 Dev_ID;
    992         UINT8 Base_Class;
    993         UINT8 Sub_Class;
    994         UINT8 Prog_Intf;
    995         UINT8 Rev;
    996         UINT16 BusDevFunc;
    997         UINT16 SubVendor_ID;
    998         UINT16 SubDevice_ID;
    999       } pci, cardbus;
   1000       struct {
   1001         UINT32 EISA_Dev_ID;
   1002         UINT8 Base_Class;
   1003         UINT8 Sub_Class;
   1004         UINT8 Prog_Intf;
   1005         UINT16 CardSelNum;
   1006       } pnp;
   1007     } info;
   1008   } PXENV_UNDI_GET_NIC_TYPE_T;
   1009   Set before calling API service
   1010   N/A
   1011   Returned from API service
   1012   Status: See the PXENV_STATUS_xxx constants.
   1013   NICType: Type of NIC information stored in the parameter
   1014   structure.
   1015   Info: Information about the fields in this union can be found
   1016   in the [PnP] and [PCI] specifications
   1017 
   1018   @param  SimpleNetworkDevice   Device instance
   1019   @param  PxeUndiTable          Point to structure which hold paramter and return value
   1020                                 for option ROM call.
   1021 
   1022   @return Return value of PXE option ROM far call.
   1023 **/
   1024 EFI_STATUS
   1025 PxeUndiGetNicType (
   1026   IN     EFI_SIMPLE_NETWORK_DEV     *SimpleNetworkDevice,
   1027   IN OUT PXENV_UNDI_GET_NIC_TYPE_T  *PxeUndiTable
   1028   )
   1029 {
   1030   return MakePxeCall (
   1031           SimpleNetworkDevice,
   1032           PxeUndiTable,
   1033           sizeof (PXENV_UNDI_GET_NIC_TYPE_T),
   1034           PXENV_UNDI_GET_NIC_TYPE
   1035           );
   1036 }
   1037 
   1038 /**
   1039   PXE
   1040   UNDI GET IFACE INFO
   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
   1043   by the caller.
   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.
   1056   typedef struct {
   1057     PXENV_STATUS Status
   1058     UINT8 IfaceType[16];
   1059     UINT32 LinkSpeed;
   1060     UINT32 ServiceFlags;
   1061     UINT32 Reserved[4];
   1062   } PXENV_UNDI_GET_NDIS_INFO_T;
   1063   Set before calling API service
   1064   N/A
   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.
   1073 
   1074   @param  SimpleNetworkDevice   Device instance
   1075   @param  PxeUndiTable          Point to structure which hold paramter and return value
   1076                                 for option ROM call.
   1077 
   1078   @return Return value of PXE option ROM far call.
   1079 **/
   1080 EFI_STATUS
   1081 PxeUndiGetNdisInfo (
   1082   IN     EFI_SIMPLE_NETWORK_DEV      *SimpleNetworkDevice,
   1083   IN OUT PXENV_UNDI_GET_NDIS_INFO_T  *PxeUndiTable
   1084   )
   1085 {
   1086   return MakePxeCall (
   1087           SimpleNetworkDevice,
   1088           PxeUndiTable,
   1089           sizeof (PXENV_UNDI_GET_NDIS_INFO_T),
   1090           PXENV_UNDI_GET_NDIS_INFO
   1091           );
   1092 }
   1093 
   1094 /**
   1095   PXE
   1096   UNDI ISR
   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
   1101   constants.
   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
   1122   now complete.
   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.
   1138 
   1139   @param  SimpleNetworkDevice   Device instance
   1140   @param  PxeUndiTable          Point to structure which hold paramter and return value
   1141                                 for option ROM call.
   1142 
   1143   @return Return value of PXE option ROM far call.
   1144 **/
   1145 EFI_STATUS
   1146 PxeUndiIsr (
   1147   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
   1148   IN OUT PXENV_UNDI_ISR_T        *PxeUndiTable
   1149   )
   1150 {
   1151   return MakePxeCall (
   1152           SimpleNetworkDevice,
   1153           PxeUndiTable,
   1154           sizeof (PXENV_UNDI_ISR_T),
   1155           PXENV_UNDI_ISR
   1156           );
   1157 }
   1158 
   1159 /**
   1160   PXE
   1161   STOP UNDI
   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
   1166   constants.
   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
   1171   memory.
   1172   Service cannot be used in protected mode.
   1173   typedef struct {
   1174     PXENV_STATUS Status;
   1175   } PXENV_STOP_UNDI_T;
   1176   Set before calling API service
   1177   N/A
   1178   Returned from API service
   1179   Status: See the PXENV_STATUS_xxx constants.
   1180 
   1181   @param  SimpleNetworkDevice   Device instance
   1182   @param  PxeUndiTable          Point to structure which hold paramter and return value
   1183                                 for option ROM call.
   1184 
   1185   @return Return value of PXE option ROM far call.
   1186 **/
   1187 EFI_STATUS
   1188 PxeUndiStop (
   1189   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
   1190   IN OUT PXENV_STOP_UNDI_T       *PxeUndiTable
   1191   )
   1192 {
   1193   return MakePxeCall (
   1194           SimpleNetworkDevice,
   1195           PxeUndiTable,
   1196           sizeof (PXENV_STOP_UNDI_T),
   1197           PXENV_STOP_UNDI
   1198           );
   1199 }
   1200 
   1201 /**
   1202   PXE
   1203   UNDI GET STATE
   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
   1209   constants
   1210   Description: This call can be used to obtain state of the UNDI engine in order to avoid issuing adverse call
   1211   sequences
   1212   typedef struct {
   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;
   1217     UINT8 UNDIstate;
   1218   } PXENV_UNDI_GET_STATE_T;
   1219   Set before calling API service
   1220   N/A
   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.
   1226   UNDI ISR
   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
   1231   constants.
   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.
   1235 
   1236   @param  SimpleNetworkDevice   Device instance
   1237   @param  PxeUndiTable          Point to structure which hold paramter and return value
   1238                                 for option ROM call.
   1239 
   1240   @return Return value of PXE option ROM far call.
   1241 **/
   1242 EFI_STATUS
   1243 PxeUndiGetState (
   1244   IN     EFI_SIMPLE_NETWORK_DEV  *SimpleNetworkDevice,
   1245   IN OUT PXENV_UNDI_GET_STATE_T  *PxeUndiTable
   1246   )
   1247 {
   1248   return MakePxeCall (
   1249           SimpleNetworkDevice,
   1250           PxeUndiTable,
   1251           sizeof (PXENV_UNDI_GET_STATE_T),
   1252           PXENV_UNDI_GET_STATE
   1253           );
   1254 }
   1255