2 Provides the Simple Network functions.
4 Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
12 This function updates the filtering on the receiver.
14 This support routine calls ::Ax88772MacAddressSet to update
15 the MAC address. This routine then rebuilds the multicast
16 hash by calling ::Ax88772MulticastClear and ::Ax88772MulticastSet.
17 Finally this routine enables the receiver by calling
20 @param [in] pSimpleNetwork Simple network mode pointer
22 @retval EFI_SUCCESS This operation was successful.
23 @retval EFI_NOT_STARTED The network interface was not started.
24 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
25 EFI_SIMPLE_NETWORK_PROTOCOL structure.
26 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
27 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
32 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
35 EFI_SIMPLE_NETWORK_MODE
* pMode
;
36 NIC_DEVICE
* pNicDevice
;
43 // Set the MAC address
45 pNicDevice
= DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork
);
46 pMode
= pSimpleNetwork
->Mode
;
47 Status
= Ax88772MacAddressSet ( pNicDevice
,
48 &pMode
->CurrentAddress
.Addr
[0]);
49 if ( !EFI_ERROR ( Status
)) {
51 // Clear the multicast hash table
53 Ax88772MulticastClear ( pNicDevice
);
56 // Load the multicast hash table
58 if ( 0 != ( pMode
->ReceiveFilterSetting
& EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST
)) {
60 ( !EFI_ERROR ( Status
)) && ( Index
< pMode
->MCastFilterCount
);
63 // Enable the next multicast address
65 Ax88772MulticastSet ( pNicDevice
,
66 &pMode
->MCastFilter
[ Index
].Addr
[0]);
71 // Enable the receiver
73 if ( !EFI_ERROR ( Status
)) {
74 Status
= Ax88772RxControl ( pNicDevice
, pMode
->ReceiveFilterSetting
);
79 // Return the operation status
81 DBG_EXIT_STATUS ( Status
);
87 This function updates the SNP driver status.
89 This function gets the current interrupt and recycled transmit
90 buffer status from the network interface. The interrupt status
91 and the media status are returned as a bit mask in InterruptStatus.
92 If InterruptStatus is NULL, the interrupt status will not be read.
93 Upon successful return of the media status, the MediaPresent field
94 of EFI_SIMPLE_NETWORK_MODE will be updated to reflect any change
95 of media status. If TxBuf is not NULL, a recycled transmit buffer
96 address will be retrived. If a recycled transmit buffer address
97 is returned in TxBuf, then the buffer has been successfully
98 transmitted, and the status for that buffer is cleared.
100 This function calls ::Ax88772Rx to update the media status and
101 queue any receive packets.
103 @param [in] pSimpleNetwork Protocol instance pointer
104 @param [in] pInterruptStatus A pointer to the bit mask of the current active interrupts.
105 If this is NULL, the interrupt status will not be read from
106 the device. If this is not NULL, the interrupt status will
107 be read from teh device. When the interrupt status is read,
108 it will also be cleared. Clearing the transmit interrupt
109 does not empty the recycled transmit buffer array.
110 @param [out] ppTxBuf Recycled transmit buffer address. The network interface will
111 not transmit if its internal recycled transmit buffer array is
112 full. Reading the transmit buffer does not clear the transmit
113 interrupt. If this is NULL, then the transmit buffer status
114 will not be read. If there are not transmit buffers to recycle
115 and TxBuf is not NULL, *TxBuf will be set to NULL.
117 @retval EFI_SUCCESS This operation was successful.
118 @retval EFI_NOT_STARTED The network interface was not started.
119 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
120 EFI_SIMPLE_NETWORK_PROTOCOL structure.
121 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
127 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
128 OUT UINT32
* pInterruptStatus
,
133 EFI_SIMPLE_NETWORK_MODE
* pMode
;
134 NIC_DEVICE
* pNicDevice
;
141 // Verify the parameters
143 if (( NULL
!= pSimpleNetwork
) && ( NULL
!= pSimpleNetwork
->Mode
)) {
145 // Return the transmit buffer
147 pNicDevice
= DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork
);
148 if (( NULL
!= ppTxBuf
) && ( NULL
!= pNicDevice
->pTxBuffer
)) {
149 *ppTxBuf
= pNicDevice
->pTxBuffer
;
150 pNicDevice
->pTxBuffer
= NULL
;
154 // Determine if interface is running
156 pMode
= pSimpleNetwork
->Mode
;
157 if ( EfiSimpleNetworkStopped
!= pMode
->State
) {
159 // Synchronize with Ax88772Timer
161 VERIFY_TPL ( TPL_AX88772
);
162 TplPrevious
= gBS
->RaiseTPL ( TPL_AX88772
);
165 // Update the link status
167 bLinkIdle
= pNicDevice
->bLinkIdle
;
168 pNicDevice
->bLinkIdle
= TRUE
;
169 Ax88772Rx ( pNicDevice
, bLinkIdle
);
170 pMode
->MediaPresent
= pNicDevice
->bLinkUp
;
173 // Release the synchronization with Ax88772Timer
175 gBS
->RestoreTPL ( TplPrevious
);
178 // Return the interrupt status
180 if ( NULL
!= pInterruptStatus
) {
181 *pInterruptStatus
= 0;
183 Status
= EFI_SUCCESS
;
186 Status
= EFI_NOT_STARTED
;
190 Status
= EFI_INVALID_PARAMETER
;
194 // Return the operation status
196 DBG_EXIT_STATUS ( Status
);
202 Resets the network adapter and allocates the transmit and receive buffers
203 required by the network interface; optionally, also requests allocation of
204 additional transmit and receive buffers. This routine must be called before
205 any other routine in the Simple Network protocol is called.
207 @param [in] pSimpleNetwork Protocol instance pointer
208 @param [in] ExtraRxBufferSize Size in bytes to add to the receive buffer allocation
209 @param [in] ExtraTxBufferSize Size in bytes to add to the transmit buffer allocation
211 @retval EFI_SUCCESS This operation was successful.
212 @retval EFI_NOT_STARTED The network interface was not started.
213 @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and receive buffers
214 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
215 EFI_SIMPLE_NETWORK_PROTOCOL structure.
216 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
217 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
223 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
224 IN UINTN ExtraRxBufferSize
,
225 IN UINTN ExtraTxBufferSize
228 EFI_SIMPLE_NETWORK_MODE
* pMode
;
234 // Verify the parameters
236 if (( NULL
!= pSimpleNetwork
) && ( NULL
!= pSimpleNetwork
->Mode
)) {
238 // Determine if the interface is already started
240 pMode
= pSimpleNetwork
->Mode
;
241 if ( EfiSimpleNetworkStarted
== pMode
->State
) {
242 if (( 0 == ExtraRxBufferSize
) && ( 0 == ExtraTxBufferSize
)) {
246 Status
= SN_Reset ( pSimpleNetwork
, FALSE
);
247 if ( !EFI_ERROR ( Status
)) {
249 // Update the network state
251 pMode
->State
= EfiSimpleNetworkInitialized
;
255 Status
= EFI_UNSUPPORTED
;
259 Status
= EFI_NOT_STARTED
;
263 Status
= EFI_INVALID_PARAMETER
;
267 // Return the operation status
269 DBG_EXIT_STATUS ( Status
);
275 This function converts a multicast IP address to a multicast HW MAC address
276 for all packet transactions.
278 @param [in] pSimpleNetwork Protocol instance pointer
279 @param [in] bIPv6 Set to TRUE if the multicast IP address is IPv6 [RFC2460].
280 Set to FALSE if the multicast IP address is IPv4 [RFC 791].
281 @param [in] pIP The multicast IP address that is to be converted to a
282 multicast HW MAC address.
283 @param [in] pMAC The multicast HW MAC address that is to be generated from IP.
285 @retval EFI_SUCCESS This operation was successful.
286 @retval EFI_NOT_STARTED The network interface was not started.
287 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
288 EFI_SIMPLE_NETWORK_PROTOCOL structure.
289 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
290 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
296 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
298 IN EFI_IP_ADDRESS
* pIP
,
299 IN EFI_MAC_ADDRESS
* pMAC
307 // This is not currently supported
309 Status
= EFI_UNSUPPORTED
;
312 // Return the operation status
314 DBG_EXIT_STATUS ( Status
);
320 This function performs read and write operations on the NVRAM device
321 attached to a network interface.
323 @param [in] pSimpleNetwork Protocol instance pointer
324 @param [in] ReadWrite TRUE for read operations, FALSE for write operations.
325 @param [in] Offset Byte offset in the NVRAM device at which to start the
326 read or write operation. This must be a multiple of
327 NvRamAccessSize and less than NvRamSize.
328 @param [in] BufferSize The number of bytes to read or write from the NVRAM device.
329 This must also be a multiple of NvramAccessSize.
330 @param [in, out] pBuffer A pointer to the data buffer.
332 @retval EFI_SUCCESS This operation was successful.
333 @retval EFI_NOT_STARTED The network interface was not started.
334 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
335 EFI_SIMPLE_NETWORK_PROTOCOL structure.
336 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
337 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
343 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
344 IN BOOLEAN ReadWrite
,
347 IN OUT VOID
* pBuffer
355 // This is not currently supported
357 Status
= EFI_UNSUPPORTED
;
360 // Return the operation status
362 DBG_EXIT_STATUS ( Status
);
368 Attempt to receive a packet from the network adapter.
370 This function retrieves one packet from the receive queue of the network
371 interface. If there are no packets on the receive queue, then EFI_NOT_READY
372 will be returned. If there is a packet on the receive queue, and the size
373 of the packet is smaller than BufferSize, then the contents of the packet
374 will be placed in Buffer, and BufferSize will be udpated with the actual
375 size of the packet. In addition, if SrcAddr, DestAddr, and Protocol are
376 not NULL, then these values will be extracted from the media header and
377 returned. If BufferSize is smaller than the received packet, then the
378 size of the receive packet will be placed in BufferSize and
379 EFI_BUFFER_TOO_SMALL will be returned.
381 This routine calls ::Ax88772Rx to update the media status and
382 empty the network adapter of receive packets.
384 @param [in] pSimpleNetwork Protocol instance pointer
385 @param [out] pHeaderSize The size, in bytes, of the media header to be filled in by
386 the Transmit() function. If HeaderSize is non-zero, then
387 it must be equal to SimpleNetwork->Mode->MediaHeaderSize
388 and DestAddr and Protocol parameters must not be NULL.
389 @param [out] pBufferSize The size, in bytes, of the entire packet (media header and
390 data) to be transmitted through the network interface.
391 @param [out] pBuffer A pointer to the packet (media header followed by data) to
392 to be transmitted. This parameter can not be NULL. If
393 HeaderSize is zero, then the media header is Buffer must
394 already be filled in by the caller. If HeaderSize is nonzero,
395 then the media header will be filled in by the Transmit()
397 @param [out] pSrcAddr The source HW MAC address. If HeaderSize is zero, then
398 this parameter is ignored. If HeaderSize is nonzero and
399 SrcAddr is NULL, then SimpleNetwork->Mode->CurrentAddress
400 is used for the source HW MAC address.
401 @param [out] pDestAddr The destination HW MAC address. If HeaderSize is zero, then
402 this parameter is ignored.
403 @param [out] pProtocol The type of header to build. If HeaderSize is zero, then
404 this parameter is ignored.
406 @retval EFI_SUCCESS This operation was successful.
407 @retval EFI_NOT_STARTED The network interface was not started.
408 @retval EFI_NOT_READY No packets have been received on the network interface.
409 @retval EFI_BUFFER_TOO_SMALL The packet is larger than BufferSize bytes.
410 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
411 EFI_SIMPLE_NETWORK_PROTOCOL structure.
412 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
418 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
419 OUT UINTN
* pHeaderSize
,
420 OUT UINTN
* pBufferSize
,
422 OUT EFI_MAC_ADDRESS
* pSrcAddr
,
423 OUT EFI_MAC_ADDRESS
* pDestAddr
,
424 OUT UINT16
* pProtocol
427 ETHERNET_HEADER
* pHeader
;
428 EFI_SIMPLE_NETWORK_MODE
* pMode
;
429 NIC_DEVICE
* pNicDevice
;
430 RX_TX_PACKET
* pRxPacket
;
438 // Verify the parameters
440 if (( NULL
!= pSimpleNetwork
) && ( NULL
!= pSimpleNetwork
->Mode
)) {
442 // The interface must be running
444 pMode
= pSimpleNetwork
->Mode
;
445 if ( EfiSimpleNetworkInitialized
== pMode
->State
) {
447 // Synchronize with Ax88772Timer
449 VERIFY_TPL ( TPL_AX88772
);
450 TplPrevious
= gBS
->RaiseTPL ( TPL_AX88772
);
453 // Update the link status
455 pNicDevice
= DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork
);
456 Ax88772Rx ( pNicDevice
, FALSE
);
457 pMode
->MediaPresent
= pNicDevice
->bLinkUp
;
458 if ( pMode
->MediaPresent
) {
460 // Attempt to receive a packet
462 pRxPacket
= pNicDevice
->pRxHead
;
463 if ( NULL
!= pRxPacket
) {
464 pNicDevice
->pRxHead
= pRxPacket
->pNext
;
465 if ( NULL
== pNicDevice
->pRxHead
) {
466 pNicDevice
->pRxTail
= NULL
;
470 // Copy the received packet into the receive buffer
472 *pBufferSize
= pRxPacket
->Length
;
473 CopyMem ( pBuffer
, &pRxPacket
->Data
[0], pRxPacket
->Length
);
474 pHeader
= (ETHERNET_HEADER
*) &pRxPacket
->Data
[0];
475 if ( NULL
!= pHeaderSize
) {
476 *pHeaderSize
= sizeof ( *pHeader
);
478 if ( NULL
!= pDestAddr
) {
479 CopyMem ( pDestAddr
, &pHeader
->dest_addr
, PXE_HWADDR_LEN_ETHER
);
481 if ( NULL
!= pSrcAddr
) {
482 CopyMem ( pSrcAddr
, &pHeader
->src_addr
, PXE_HWADDR_LEN_ETHER
);
484 if ( NULL
!= pProtocol
) {
485 Type
= pHeader
->type
;
486 Type
= (UINT16
)(( Type
>> 8 ) | ( Type
<< 8 ));
489 Status
= EFI_SUCCESS
;
493 // No receive packets available
495 Status
= EFI_NOT_READY
;
502 Status
= EFI_NOT_READY
;
506 // Release the synchronization with Ax88772Timer
508 gBS
->RestoreTPL ( TplPrevious
);
511 Status
= EFI_NOT_STARTED
;
515 Status
= EFI_INVALID_PARAMETER
;
519 // Return the operation status
521 DBG_EXIT_STATUS ( Status
);
527 This function is used to enable and disable the hardware and software receive
528 filters for the underlying network device.
530 The receive filter change is broken down into three steps:
532 1. The filter mask bits that are set (ON) in the Enable parameter
533 are added to the current receive filter settings.
535 2. The filter mask bits that are set (ON) in the Disable parameter
536 are subtracted from the updated receive filter settins.
538 3. If the resulting filter settigns is not supported by the hardware
539 a more liberal setting is selected.
541 If the same bits are set in the Enable and Disable parameters, then the bits
542 in the Disable parameter takes precedence.
544 If the ResetMCastFilter parameter is TRUE, then the multicast address list
545 filter is disabled (irregardless of what other multicast bits are set in
546 the enable and Disable parameters). The SNP->Mode->MCastFilterCount field
547 is set to zero. The SNP->Mode->MCastFilter contents are undefined.
549 After enableing or disabling receive filter settings, software should
550 verify the new settings by checking the SNP->Mode->ReceeiveFilterSettings,
551 SNP->Mode->MCastFilterCount and SNP->Mode->MCastFilter fields.
553 Note: Some network drivers and/or devices will automatically promote
554 receive filter settings if the requested setting can not be honored.
555 For example, if a request for four multicast addresses is made and
556 the underlying hardware only supports two multicast addresses the
557 driver might set the promiscuous or promiscuous multicast receive filters
558 instead. The receiving software is responsible for discarding any extra
559 packets that get through the hardware receive filters.
561 If ResetMCastFilter is TRUE, then the multicast receive filter list
562 on the network interface will be reset to the default multicast receive
563 filter list. If ResetMCastFilter is FALSE, and this network interface
564 allows the multicast receive filter list to be modified, then the
565 MCastFilterCnt and MCastFilter are used to update the current multicast
566 receive filter list. The modified receive filter list settings can be
567 found in the MCastFilter field of EFI_SIMPLE_NETWORK_MODE.
569 This routine calls ::ReceiveFilterUpdate to update the receive
570 state in the network adapter.
572 @param [in] pSimpleNetwork Protocol instance pointer
573 @param [in] Enable A bit mask of receive filters to enable on the network interface.
574 @param [in] Disable A bit mask of receive filters to disable on the network interface.
575 For backward compatibility with EFI 1.1 platforms, the
576 EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit must be set
577 when the ResetMCastFilter parameter is TRUE.
578 @param [in] bResetMCastFilter Set to TRUE to reset the contents of the multicast receive
579 filters on the network interface to their default values.
580 @param [in] MCastFilterCnt Number of multicast HW MAC address in the new MCastFilter list.
581 This value must be less than or equal to the MaxMCastFilterCnt
582 field of EFI_SIMPLE_NETWORK_MODE. This field is optional if
583 ResetMCastFilter is TRUE.
584 @param [in] pMCastFilter A pointer to a list of new multicast receive filter HW MAC
585 addresses. This list will replace any existing multicast
586 HW MAC address list. This field is optional if ResetMCastFilter
589 @retval EFI_SUCCESS This operation was successful.
590 @retval EFI_NOT_STARTED The network interface was not started.
591 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
592 EFI_SIMPLE_NETWORK_PROTOCOL structure.
593 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
594 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
600 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
603 IN BOOLEAN bResetMCastFilter
,
604 IN UINTN MCastFilterCnt
,
605 IN EFI_MAC_ADDRESS
* pMCastFilter
608 EFI_SIMPLE_NETWORK_MODE
* pMode
;
609 EFI_MAC_ADDRESS
* pMulticastAddress
;
610 EFI_MAC_ADDRESS
* pTableEnd
;
616 // Verify the parameters
618 Status
= EFI_INVALID_PARAMETER
;
619 if (( NULL
!= pSimpleNetwork
) && ( NULL
!= pSimpleNetwork
->Mode
)) {
620 pMode
= pSimpleNetwork
->Mode
;
623 // Update the multicast list if necessary
625 if ( !bResetMCastFilter
) {
626 if ( 0 != MCastFilterCnt
) {
627 if (( MAX_MCAST_FILTER_CNT
>= MCastFilterCnt
)
628 && ( NULL
!= pMCastFilter
)) {
630 // Verify the multicast addresses
632 pMulticastAddress
= pMCastFilter
;
633 pTableEnd
= pMulticastAddress
+ MCastFilterCnt
;
634 while ( pTableEnd
> pMulticastAddress
) {
636 // The first digit of the multicast address must have the LSB set
638 if ( 0 == ( pMulticastAddress
->Addr
[0] & 1 )) {
640 // Invalid multicast address
644 pMulticastAddress
+= 1;
646 if ( pTableEnd
== pMulticastAddress
) {
648 // Update the multicast filter list.
650 CopyMem (&pMode
->MCastFilter
[0],
652 MCastFilterCnt
* sizeof ( *pMCastFilter
));
653 Status
= EFI_SUCCESS
;
658 Status
= EFI_SUCCESS
;
663 // No multicast address list is specified
666 Status
= EFI_SUCCESS
;
668 if ( !EFI_ERROR ( Status
)) {
670 // The parameters are valid!
672 pMode
->ReceiveFilterSetting
|= Enable
;
673 pMode
->ReceiveFilterSetting
&= ~Disable
;
674 pMode
->MCastFilterCount
= (UINT32
)MCastFilterCnt
;
677 // Update the receive filters in the adapter
679 Status
= ReceiveFilterUpdate ( pSimpleNetwork
);
684 // Return the operation status
686 DBG_EXIT_STATUS ( Status
);
692 Reset the network adapter.
694 Resets a network adapter and reinitializes it with the parameters that
695 were provided in the previous call to Initialize (). The transmit and
696 receive queues are cleared. Receive filters, the station address, the
697 statistics, and the multicast-IP-to-HW MAC addresses are not reset by
700 This routine calls ::Ax88772Reset to perform the adapter specific
701 reset operation. This routine also starts the link negotiation
702 by calling ::Ax88772NegotiateLinkStart.
704 @param [in] pSimpleNetwork Protocol instance pointer
705 @param [in] bExtendedVerification Indicates that the driver may perform a more
706 exhaustive verification operation of the device
709 @retval EFI_SUCCESS This operation was successful.
710 @retval EFI_NOT_STARTED The network interface was not started.
711 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
712 EFI_SIMPLE_NETWORK_PROTOCOL structure.
713 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
714 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
720 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
721 IN BOOLEAN bExtendedVerification
724 EFI_SIMPLE_NETWORK_MODE
* pMode
;
725 NIC_DEVICE
* pNicDevice
;
726 RX_TX_PACKET
* pRxPacket
;
733 // Verify the parameters
735 if (( NULL
!= pSimpleNetwork
) && ( NULL
!= pSimpleNetwork
->Mode
)) {
737 // Synchronize with Ax88772Timer
739 VERIFY_TPL ( TPL_AX88772
);
740 TplPrevious
= gBS
->RaiseTPL ( TPL_AX88772
);
743 // Update the device state
745 pNicDevice
= DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork
);
746 pNicDevice
->bComplete
= FALSE
;
747 pNicDevice
->bLinkUp
= FALSE
;
749 pMode
= pSimpleNetwork
->Mode
;
750 pMode
->MediaPresent
= FALSE
;
753 // Discard any received packets
755 while ( NULL
!= pNicDevice
->pRxHead
) {
757 // Remove the packet from the received packet list
759 pRxPacket
= pNicDevice
->pRxHead
;
760 pNicDevice
->pRxHead
= pRxPacket
->pNext
;
763 // Queue the packet to the free list
765 pRxPacket
->pNext
= pNicDevice
->pRxFree
;
766 pNicDevice
->pRxFree
= pRxPacket
;
768 pNicDevice
->pRxTail
= NULL
;
773 Status
= Ax88772Reset ( pNicDevice
);
774 if ( !EFI_ERROR ( Status
)) {
776 // Update the receive filters in the adapter
778 Status
= ReceiveFilterUpdate ( pSimpleNetwork
);
781 // Try to get a connection to the network
783 if ( !EFI_ERROR ( Status
)) {
785 // Start the autonegotiation
787 Status
= Ax88772NegotiateLinkStart ( pNicDevice
);
792 // Release the synchronization with Ax88772Timer
794 gBS
->RestoreTPL ( TplPrevious
);
797 Status
= EFI_INVALID_PARAMETER
;
801 // Return the operation status
803 DBG_EXIT_STATUS ( Status
);
809 Initialize the simple network protocol.
811 This routine calls ::Ax88772MacAddressGet to obtain the
814 @param [in] pNicDevice NIC_DEVICE_INSTANCE pointer
816 @retval EFI_SUCCESS Setup was successful
821 IN NIC_DEVICE
* pNicDevice
824 EFI_SIMPLE_NETWORK_MODE
* pMode
;
825 EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
;
831 // Initialize the simple network protocol
833 pSimpleNetwork
= &pNicDevice
->SimpleNetwork
;
834 pSimpleNetwork
->Revision
= EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
;
835 pSimpleNetwork
->Start
= (EFI_SIMPLE_NETWORK_START
)SN_Start
;
836 pSimpleNetwork
->Stop
= (EFI_SIMPLE_NETWORK_STOP
)SN_Stop
;
837 pSimpleNetwork
->Initialize
= (EFI_SIMPLE_NETWORK_INITIALIZE
)SN_Initialize
;
838 pSimpleNetwork
->Reset
= (EFI_SIMPLE_NETWORK_RESET
)SN_Reset
;
839 pSimpleNetwork
->Shutdown
= (EFI_SIMPLE_NETWORK_SHUTDOWN
)SN_Shutdown
;
840 pSimpleNetwork
->ReceiveFilters
= (EFI_SIMPLE_NETWORK_RECEIVE_FILTERS
)SN_ReceiveFilters
;
841 pSimpleNetwork
->StationAddress
= (EFI_SIMPLE_NETWORK_STATION_ADDRESS
)SN_StationAddress
;
842 pSimpleNetwork
->Statistics
= (EFI_SIMPLE_NETWORK_STATISTICS
)SN_Statistics
;
843 pSimpleNetwork
->MCastIpToMac
= (EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC
)SN_MCastIPtoMAC
;
844 pSimpleNetwork
->NvData
= (EFI_SIMPLE_NETWORK_NVDATA
)SN_NvData
;
845 pSimpleNetwork
->GetStatus
= (EFI_SIMPLE_NETWORK_GET_STATUS
)SN_GetStatus
;
846 pSimpleNetwork
->Transmit
= (EFI_SIMPLE_NETWORK_TRANSMIT
)SN_Transmit
;
847 pSimpleNetwork
->Receive
= (EFI_SIMPLE_NETWORK_RECEIVE
)SN_Receive
;
848 pSimpleNetwork
->WaitForPacket
= NULL
;
849 pMode
= &pNicDevice
->SimpleNetworkData
;
850 pSimpleNetwork
->Mode
= pMode
;
852 pMode
->State
= EfiSimpleNetworkStopped
;
853 pMode
->HwAddressSize
= PXE_HWADDR_LEN_ETHER
;
854 pMode
->MediaHeaderSize
= sizeof ( ETHERNET_HEADER
);
855 pMode
->MaxPacketSize
= MAX_ETHERNET_PKT_SIZE
;
856 pMode
->NvRamSize
= 0;
857 pMode
->NvRamAccessSize
= 0;
858 pMode
->ReceiveFilterMask
= EFI_SIMPLE_NETWORK_RECEIVE_UNICAST
859 | EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST
860 | EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST
861 | EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS
862 | EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST
;
863 pMode
->ReceiveFilterSetting
= EFI_SIMPLE_NETWORK_RECEIVE_UNICAST
864 | EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST
;
865 pMode
->MaxMCastFilterCount
= MAX_MCAST_FILTER_CNT
;
866 pMode
->MCastFilterCount
= 0;
867 SetMem ( &pMode
->BroadcastAddress
,
868 PXE_HWADDR_LEN_ETHER
,
870 pMode
->IfType
= EfiNetworkInterfaceUndi
;
871 pMode
->MacAddressChangeable
= TRUE
;
872 pMode
->MultipleTxSupported
= TRUE
;
873 pMode
->MediaPresentSupported
= TRUE
;
874 pMode
->MediaPresent
= FALSE
;
877 // Read the MAC address
879 pNicDevice
->PhyId
= PHY_ID_INTERNAL
;
880 pNicDevice
->b100Mbps
= TRUE
;
881 pNicDevice
->bFullDuplex
= TRUE
;
883 Status
= gBS
->AllocatePool ( EfiRuntimeServicesData
,
885 (VOID
**) &pNicDevice
->pBulkInBuff
);
886 if ( EFI_ERROR(Status
)) {
887 DEBUG (( EFI_D_ERROR
, "Memory are not enough\n"));
891 Status
= Ax88772MacAddressGet (
893 &pMode
->PermanentAddress
.Addr
[0]);
894 if ( !EFI_ERROR ( Status
)) {
896 // Display the MAC address
898 DEBUG (( DEBUG_MAC_ADDRESS
| DEBUG_INFO
,
899 "MAC: %02x-%02x-%02x-%02x-%02x-%02x\n",
900 pMode
->PermanentAddress
.Addr
[0],
901 pMode
->PermanentAddress
.Addr
[1],
902 pMode
->PermanentAddress
.Addr
[2],
903 pMode
->PermanentAddress
.Addr
[3],
904 pMode
->PermanentAddress
.Addr
[4],
905 pMode
->PermanentAddress
.Addr
[5]));
908 // Use the hardware address as the current address
910 CopyMem ( &pMode
->CurrentAddress
,
911 &pMode
->PermanentAddress
,
912 PXE_HWADDR_LEN_ETHER
);
916 // Return the setup status
918 DBG_EXIT_STATUS ( Status
);
924 This routine starts the network interface.
926 @param [in] pSimpleNetwork Protocol instance pointer
928 @retval EFI_SUCCESS This operation was successful.
929 @retval EFI_ALREADY_STARTED The network interface was already started.
930 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
931 EFI_SIMPLE_NETWORK_PROTOCOL structure.
932 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
933 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
939 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
942 NIC_DEVICE
* pNicDevice
;
943 EFI_SIMPLE_NETWORK_MODE
* pMode
;
949 // Verify the parameters
951 Status
= EFI_INVALID_PARAMETER
;
952 if (( NULL
!= pSimpleNetwork
) && ( NULL
!= pSimpleNetwork
->Mode
)) {
953 pMode
= pSimpleNetwork
->Mode
;
954 if ( EfiSimpleNetworkStopped
== pMode
->State
) {
956 // Initialize the mode structure
957 // NVRAM access is not supported
959 ZeroMem ( pMode
, sizeof ( *pMode
));
961 pMode
->State
= EfiSimpleNetworkStarted
;
962 pMode
->HwAddressSize
= PXE_HWADDR_LEN_ETHER
;
963 pMode
->MediaHeaderSize
= sizeof ( ETHERNET_HEADER
);
964 pMode
->MaxPacketSize
= MAX_ETHERNET_PKT_SIZE
;
965 pMode
->ReceiveFilterMask
= EFI_SIMPLE_NETWORK_RECEIVE_UNICAST
966 | EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST
967 | EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST
968 | EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS
969 | EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST
;
970 pMode
->ReceiveFilterSetting
= EFI_SIMPLE_NETWORK_RECEIVE_UNICAST
;
971 pMode
->MaxMCastFilterCount
= MAX_MCAST_FILTER_CNT
;
972 pNicDevice
= DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork
);
973 Status
= Ax88772MacAddressGet ( pNicDevice
, &pMode
->PermanentAddress
.Addr
[0]);
974 CopyMem ( &pMode
->CurrentAddress
,
975 &pMode
->PermanentAddress
,
976 sizeof ( pMode
->CurrentAddress
));
977 pMode
->BroadcastAddress
.Addr
[0] = 0xff;
978 pMode
->BroadcastAddress
.Addr
[1] = 0xff;
979 pMode
->BroadcastAddress
.Addr
[2] = 0xff;
980 pMode
->BroadcastAddress
.Addr
[3] = 0xff;
981 pMode
->BroadcastAddress
.Addr
[4] = 0xff;
982 pMode
->BroadcastAddress
.Addr
[5] = 0xff;
984 pMode
->MacAddressChangeable
= TRUE
;
985 pMode
->MultipleTxSupported
= TRUE
;
986 pMode
->MediaPresentSupported
= TRUE
;
987 pMode
->MediaPresent
= FALSE
;
990 Status
= EFI_ALREADY_STARTED
;
995 // Return the operation status
997 DBG_EXIT_STATUS ( Status
);
1003 Set the MAC address.
1005 This function modifies or resets the current station address of a
1006 network interface. If Reset is TRUE, then the current station address
1007 is set ot the network interface's permanent address. If Reset if FALSE
1008 then the current station address is changed to the address specified by
1011 This routine calls ::Ax88772MacAddressSet to update the MAC address
1012 in the network adapter.
1014 @param [in] pSimpleNetwork Protocol instance pointer
1015 @param [in] bReset Flag used to reset the station address to the
1016 network interface's permanent address.
1017 @param [in] pNew New station address to be used for the network
1020 @retval EFI_SUCCESS This operation was successful.
1021 @retval EFI_NOT_STARTED The network interface was not started.
1022 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
1023 EFI_SIMPLE_NETWORK_PROTOCOL structure.
1024 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
1025 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
1031 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
1033 IN EFI_MAC_ADDRESS
* pNew
1036 NIC_DEVICE
* pNicDevice
;
1037 EFI_SIMPLE_NETWORK_MODE
* pMode
;
1043 // Verify the parameters
1045 if (( NULL
!= pSimpleNetwork
)
1046 && ( NULL
!= pSimpleNetwork
->Mode
)
1047 && (( !bReset
) || ( bReset
&& ( NULL
!= pNew
)))) {
1049 // Verify that the adapter is already started
1051 pNicDevice
= DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork
);
1052 pMode
= pSimpleNetwork
->Mode
;
1053 if ( EfiSimpleNetworkStarted
== pMode
->State
) {
1055 // Determine the adapter MAC address
1059 // Use the permanent address
1061 CopyMem ( &pMode
->CurrentAddress
,
1062 &pMode
->PermanentAddress
,
1063 sizeof ( pMode
->CurrentAddress
));
1067 // Use the specified address
1069 CopyMem ( &pMode
->CurrentAddress
,
1071 sizeof ( pMode
->CurrentAddress
));
1075 // Update the address on the adapter
1077 Status
= Ax88772MacAddressSet ( pNicDevice
, &pMode
->CurrentAddress
.Addr
[0]);
1080 Status
= EFI_NOT_STARTED
;
1084 Status
= EFI_INVALID_PARAMETER
;
1088 // Return the operation status
1090 DBG_EXIT_STATUS ( Status
);
1096 This function resets or collects the statistics on a network interface.
1097 If the size of the statistics table specified by StatisticsSize is not
1098 big enough for all of the statistics that are collected by the network
1099 interface, then a partial buffer of statistics is returned in
1102 @param [in] pSimpleNetwork Protocol instance pointer
1103 @param [in] bReset Set to TRUE to reset the statistics for the network interface.
1104 @param [in, out] pStatisticsSize On input the size, in bytes, of StatisticsTable. On output
1105 the size, in bytes, of the resulting table of statistics.
1106 @param [out] pStatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
1107 conains the statistics.
1109 @retval EFI_SUCCESS This operation was successful.
1110 @retval EFI_NOT_STARTED The network interface was not started.
1111 @retval EFI_BUFFER_TOO_SMALL The pStatisticsTable is NULL or the buffer is too small.
1112 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
1113 EFI_SIMPLE_NETWORK_PROTOCOL structure.
1114 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
1115 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
1121 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
1123 IN OUT UINTN
* pStatisticsSize
,
1124 OUT EFI_NETWORK_STATISTICS
* pStatisticsTable
1132 // This is not currently supported
1134 Status
= EFI_UNSUPPORTED
;
1137 // Return the operation status
1139 DBG_EXIT_STATUS ( Status
);
1145 This function stops a network interface. This call is only valid
1146 if the network interface is in the started state.
1148 @param [in] pSimpleNetwork Protocol instance pointer
1150 @retval EFI_SUCCESS This operation was successful.
1151 @retval EFI_NOT_STARTED The network interface was not started.
1152 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
1153 EFI_SIMPLE_NETWORK_PROTOCOL structure.
1154 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
1155 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
1161 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
1164 EFI_SIMPLE_NETWORK_MODE
* pMode
;
1170 // Verify the parameters
1172 if (( NULL
!= pSimpleNetwork
) && ( NULL
!= pSimpleNetwork
->Mode
)) {
1174 // Determine if the interface is started
1176 pMode
= pSimpleNetwork
->Mode
;
1177 if ( EfiSimpleNetworkStopped
!= pMode
->State
) {
1178 if ( EfiSimpleNetworkStarted
== pMode
->State
) {
1180 // Release the resources acquired in SN_Start
1184 // Mark the adapter as stopped
1186 pMode
->State
= EfiSimpleNetworkStopped
;
1187 Status
= EFI_SUCCESS
;
1190 Status
= EFI_UNSUPPORTED
;
1194 Status
= EFI_NOT_STARTED
;
1198 Status
= EFI_INVALID_PARAMETER
;
1202 // Return the operation status
1204 DBG_EXIT_STATUS ( Status
);
1210 This function releases the memory buffers assigned in the Initialize() call.
1211 Pending transmits and receives are lost, and interrupts are cleared and disabled.
1212 After this call, only Initialize() and Stop() calls may be used.
1214 @param [in] pSimpleNetwork Protocol instance pointer
1216 @retval EFI_SUCCESS This operation was successful.
1217 @retval EFI_NOT_STARTED The network interface was not started.
1218 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
1219 EFI_SIMPLE_NETWORK_PROTOCOL structure.
1220 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
1221 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
1227 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
1230 EFI_SIMPLE_NETWORK_MODE
* pMode
;
1237 // Verify the parameters
1239 if (( NULL
!= pSimpleNetwork
) && ( NULL
!= pSimpleNetwork
->Mode
)) {
1241 // Determine if the interface is already started
1243 pMode
= pSimpleNetwork
->Mode
;
1244 if ( EfiSimpleNetworkInitialized
== pMode
->State
) {
1248 RxFilter
= pMode
->ReceiveFilterSetting
;
1249 pMode
->ReceiveFilterSetting
= 0;
1250 Status
= SN_Reset ( pSimpleNetwork
, FALSE
);
1251 pMode
->ReceiveFilterSetting
= RxFilter
;
1252 if ( !EFI_ERROR ( Status
)) {
1254 // Release the resources acquired by SN_Initialize
1258 // Update the network state
1260 pMode
->State
= EfiSimpleNetworkStarted
;
1264 Status
= EFI_NOT_STARTED
;
1268 Status
= EFI_INVALID_PARAMETER
;
1272 // Return the operation status
1274 DBG_EXIT_STATUS ( Status
);
1280 Send a packet over the network.
1282 This function places the packet specified by Header and Buffer on
1283 the transmit queue. This function performs a non-blocking transmit
1284 operation. When the transmit is complete, the buffer is returned
1285 via the GetStatus() call.
1287 This routine calls ::Ax88772Rx to empty the network adapter of
1288 receive packets. The routine then passes the transmit packet
1289 to the network adapter.
1291 @param [in] pSimpleNetwork Protocol instance pointer
1292 @param [in] HeaderSize The size, in bytes, of the media header to be filled in by
1293 the Transmit() function. If HeaderSize is non-zero, then
1294 it must be equal to SimpleNetwork->Mode->MediaHeaderSize
1295 and DestAddr and Protocol parameters must not be NULL.
1296 @param [in] BufferSize The size, in bytes, of the entire packet (media header and
1297 data) to be transmitted through the network interface.
1298 @param [in] pBuffer A pointer to the packet (media header followed by data) to
1299 to be transmitted. This parameter can not be NULL. If
1300 HeaderSize is zero, then the media header is Buffer must
1301 already be filled in by the caller. If HeaderSize is nonzero,
1302 then the media header will be filled in by the Transmit()
1304 @param [in] pSrcAddr The source HW MAC address. If HeaderSize is zero, then
1305 this parameter is ignored. If HeaderSize is nonzero and
1306 SrcAddr is NULL, then SimpleNetwork->Mode->CurrentAddress
1307 is used for the source HW MAC address.
1308 @param [in] pDestAddr The destination HW MAC address. If HeaderSize is zero, then
1309 this parameter is ignored.
1310 @param [in] pProtocol The type of header to build. If HeaderSize is zero, then
1311 this parameter is ignored.
1313 @retval EFI_SUCCESS This operation was successful.
1314 @retval EFI_NOT_STARTED The network interface was not started.
1315 @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.
1316 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
1317 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
1318 EFI_SIMPLE_NETWORK_PROTOCOL structure.
1319 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
1325 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
1326 IN UINTN HeaderSize
,
1327 IN UINTN BufferSize
,
1329 IN EFI_MAC_ADDRESS
* pSrcAddr
,
1330 IN EFI_MAC_ADDRESS
* pDestAddr
,
1331 IN UINT16
* pProtocol
1334 RX_TX_PACKET Packet
;
1335 ETHERNET_HEADER
* pHeader
;
1336 EFI_SIMPLE_NETWORK_MODE
* pMode
;
1337 NIC_DEVICE
* pNicDevice
;
1338 EFI_USB_IO_PROTOCOL
* pUsbIo
;
1340 EFI_TPL TplPrevious
;
1341 UINTN TransferLength
;
1342 UINT32 TransferStatus
;
1348 // Verify the parameters
1350 if (( NULL
!= pSimpleNetwork
) && ( NULL
!= pSimpleNetwork
->Mode
)) {
1352 // The interface must be running
1354 pMode
= pSimpleNetwork
->Mode
;
1355 if ( EfiSimpleNetworkInitialized
== pMode
->State
) {
1357 // Synchronize with Ax88772Timer
1359 VERIFY_TPL ( TPL_AX88772
);
1360 TplPrevious
= gBS
->RaiseTPL ( TPL_AX88772
);
1363 // Update the link status
1365 pNicDevice
= DEV_FROM_SIMPLE_NETWORK ( pSimpleNetwork
);
1368 //No need to call receive to receive packet
1370 //Ax88772Rx ( pNicDevice, FALSE );
1371 pMode
->MediaPresent
= pNicDevice
->bLinkUp
;
1374 // Release the synchronization with Ax88772Timer
1376 gBS
->RestoreTPL ( TplPrevious
);
1377 if ( pMode
->MediaPresent
) {
1379 // Copy the packet into the USB buffer
1381 CopyMem ( &Packet
.Data
[0], pBuffer
, BufferSize
);
1382 Packet
.Length
= (UINT16
) BufferSize
;
1385 // Transmit the packet
1387 pHeader
= (ETHERNET_HEADER
*) &Packet
.Data
[0];
1388 if ( 0 != HeaderSize
) {
1389 if ( NULL
!= pDestAddr
) {
1390 CopyMem ( &pHeader
->dest_addr
, pDestAddr
, PXE_HWADDR_LEN_ETHER
);
1392 if ( NULL
!= pSrcAddr
) {
1393 CopyMem ( &pHeader
->src_addr
, pSrcAddr
, PXE_HWADDR_LEN_ETHER
);
1396 CopyMem ( &pHeader
->src_addr
, &pMode
->CurrentAddress
.Addr
[0], PXE_HWADDR_LEN_ETHER
);
1398 if ( NULL
!= pProtocol
) {
1402 Type
= Packet
.Length
;
1404 Type
= (UINT16
)(( Type
>> 8 ) | ( Type
<< 8 ));
1405 pHeader
->type
= Type
;
1407 if ( Packet
.Length
< MIN_ETHERNET_PKT_SIZE
) {
1408 Packet
.Length
= MIN_ETHERNET_PKT_SIZE
;
1409 ZeroMem ( &Packet
.Data
[ BufferSize
],
1410 Packet
.Length
- BufferSize
);
1412 DEBUG (( DEBUG_TX
| DEBUG_INFO
,
1413 "TX: %02x-%02x-%02x-%02x-%02x-%02x %02x-%02x-%02x-%02x-%02x-%02x %02x-%02x %d bytes\r\n",
1429 Packet
.LengthBar
= ~Packet
.Length
;
1430 TransferLength
= sizeof ( Packet
.Length
)
1431 + sizeof ( Packet
.LengthBar
)
1435 // Work around USB bus driver bug where a timeout set by receive
1436 // succeeds but the timeout expires immediately after, causing the
1437 // transmit operation to timeout.
1439 pUsbIo
= pNicDevice
->pUsbIo
;
1440 Status
= pUsbIo
->UsbBulkTransfer ( pUsbIo
,
1446 if ( !EFI_ERROR ( Status
)) {
1447 Status
= TransferStatus
;
1449 if (( !EFI_ERROR ( Status
))
1450 && ( TransferLength
!= (UINTN
)( Packet
.Length
+ 4 ))) {
1451 Status
= EFI_WARN_WRITE_FAILURE
;
1453 if ( EFI_SUCCESS
== Status
) {
1454 pNicDevice
->pTxBuffer
= pBuffer
;
1457 DEBUG (( DEBUG_ERROR
| DEBUG_INFO
,
1458 "Ax88772 USB transmit error, TransferLength: %d, Status: %r\r\n",
1459 sizeof ( Packet
.Length
) + Packet
.Length
,
1462 // Reset the controller to fix the error
1464 if ( EFI_DEVICE_ERROR
== Status
) {
1465 SN_Reset ( pSimpleNetwork
, FALSE
);
1471 // No packets available.
1473 Status
= EFI_NOT_READY
;
1477 Status
= EFI_NOT_STARTED
;
1481 DEBUG (( DEBUG_ERROR
| DEBUG_INFO
,
1482 "Ax88772 invalid transmit parameter\r\n"
1483 " 0x%08x: HeaderSize\r\n"
1484 " 0x%08x: BufferSize\r\n"
1485 " 0x%08x: Buffer\r\n"
1486 " 0x%08x: SrcAddr\r\n"
1487 " 0x%08x: DestAddr\r\n"
1488 " 0x%04x: Protocol\r\n",
1495 Status
= EFI_INVALID_PARAMETER
;
1499 // Return the operation status
1501 DBG_EXIT_STATUS ( Status
);