2 Definitions for ASIX AX88772 Ethernet adapter.
4 Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
14 #include <Guid/EventGroup.h>
16 #include <IndustryStandard/Pci.h>
18 #include <Library/BaseMemoryLib.h>
19 #include <Library/DebugLib.h>
20 #include <Library/DevicePathLib.h>
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/UefiDriverEntryPoint.h>
23 #include <Library/UefiLib.h>
24 #include <Library/UefiRuntimeLib.h>
26 #include <Protocol/DevicePath.h>
27 #include <Protocol/LoadedImage.h>
28 #include <Protocol/NetworkInterfaceIdentifier.h>
29 #include <Protocol/SimpleNetwork.h>
30 #include <Protocol/UsbIo.h>
32 //------------------------------------------------------------------------------
34 //------------------------------------------------------------------------------
36 //Too many output debug info hangs system in Debug tip
38 //#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */
39 //#define DBG_ENTER() DEBUG (( DEBUG_INFO, "Entering " __FUNCTION__ "\n" )) ///< Display routine entry
40 //#define DBG_EXIT() DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ "\n" )) ///< Display routine exit
41 //#define DBG_EXIT_DEC(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: %d\n", Status )) ///< Display routine exit with decimal value
42 //#define DBG_EXIT_HEX(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: 0x%08x\n", Status )) ///< Display routine exit with hex value
43 //#define DBG_EXIT_STATUS(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: %r\n", Status )) ///< Display routine exit with status value
44 //#define DBG_EXIT_TF(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", returning %s\n", (FALSE == Status) ? L"FALSE" : L"TRUE" )) ///< Display routine with TRUE/FALSE value
46 #define DBG_ENTER() ///< Display routine entry
47 #define DBG_EXIT() ///< Display routine exit
48 #define DBG_EXIT_DEC(Status) ///< Display routine exit with decimal value
49 #define DBG_EXIT_HEX(Status) ///< Display routine exit with hex value
50 #define DBG_EXIT_STATUS(Status) ///< Display routine exit with status value
51 #define DBG_EXIT_TF(Status) ///< Display routine with TRUE/FALSE value
54 #define USB_IS_IN_ENDPOINT(EndPointAddr) (((EndPointAddr) & BIT7) != 0) ///< Return TRUE/FALSE for IN direction
55 #define USB_IS_OUT_ENDPOINT(EndPointAddr) (((EndPointAddr) & BIT7) == 0) ///< Return TRUE/FALSE for OUT direction
56 #define USB_IS_BULK_ENDPOINT(Attribute) (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_BULK) ///< Return TRUE/FALSE for BULK type
57 #define USB_IS_INTERRUPT_ENDPOINT(Attribute) (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) ///< Return TRUE/FALSE for INTERRUPT type
59 //------------------------------------------------------------------------------
61 //------------------------------------------------------------------------------
63 #define DEBUG_RX_BROADCAST 0x40000000 ///< Display RX broadcast messages
64 #define DEBUG_RX_MULTICAST 0x20000000 ///< Display RX multicast messages
65 #define DEBUG_RX_UNICAST 0x10000000 ///< Display RX unicast messages
66 #define DEBUG_MAC_ADDRESS 0x08000000 ///< Display the MAC address
67 #define DEBUG_LINK 0x04000000 ///< Display the link status
68 #define DEBUG_TX 0x02000000 ///< Display the TX messages
69 #define DEBUG_PHY 0x01000000 ///< Display the PHY register values
70 #define DEBUG_SROM 0x00800000 ///< Display the SROM contents
71 #define DEBUG_TIMER 0x00400000 ///< Display the timer routine entry/exit
72 #define DEBUG_TPL 0x00200000 ///< Display the timer routine entry/exit
74 #define AX88772_MAX_PKT_SIZE ( 2048 - 4 ) ///< Maximum packet size
75 #define ETHERNET_HEADER_SIZE sizeof ( ETHERNET_HEADER ) ///< Size in bytes of the Ethernet header
76 #define MIN_ETHERNET_PKT_SIZE 60 ///< Minimum packet size including Ethernet header
77 #define MAX_ETHERNET_PKT_SIZE 1500 ///< Ethernet spec 3.1.1: Minimum packet size
78 #define MAX_BULKIN_SIZE 2048 ///< Maximum size of one UsbBulk
81 #define USB_NETWORK_CLASS 0x09 ///< USB Network class code
82 #define USB_BUS_TIMEOUT 1000 ///< USB timeout in milliseconds
84 #define TIMER_MSEC 20 ///< Polling interval for the NIC
85 #define TPL_AX88772 TPL_CALLBACK ///< TPL for routine synchronization
90 This macro which is enabled when debug is enabled verifies that
91 the new TPL value is >= the current TPL value.
97 #if !defined(MDEPKG_NDEBUG)
99 #define VERIFY_TPL(tpl) \
101 EFI_TPL PreviousTpl; \
103 PreviousTpl = gBS->RaiseTPL ( TPL_HIGH_LEVEL ); \
104 gBS->RestoreTPL ( PreviousTpl ); \
105 if ( PreviousTpl > tpl ) { \
106 DEBUG (( DEBUG_ERROR, "Current TPL: %d, New TPL: %d\r\n", PreviousTpl, tpl )); \
107 ASSERT ( PreviousTpl <= tpl ); \
111 #else // MDEPKG_NDEBUG
113 #define VERIFY_TPL(tpl)
115 #endif // MDEPKG_NDEBUG
117 //------------------------------------------------------------------------------
118 // Hardware Definition
119 //------------------------------------------------------------------------------
121 #define DEV_SIGNATURE SIGNATURE_32 ('A','X','8','8') ///< Signature of data structures in memory
123 #define VENDOR_ID 0x0b95 ///< Vendor ID for Asix
124 #define PRODUCT_ID 0x7720 ///< Product ID for the AX88772 USB 10/100 Ethernet controller
126 #define RESET_MSEC 1000 ///< Reset duration
127 #define PHY_RESET_MSEC 500 ///< PHY reset duration
130 // RX Control register
133 #define RXC_PRO 0x0001 ///< Receive all packets
134 #define RXC_AMALL 0x0002 ///< Receive all multicast packets
135 #define RXC_SEP 0x0004 ///< Save error packets
136 #define RXC_AB 0x0008 ///< Receive broadcast packets
137 #define RXC_AM 0x0010 ///< Use multicast destination address hash table
138 #define RXC_AP 0x0020 ///< Accept physical address from Multicast Filter
139 #define RXC_SO 0x0080 ///< Start operation
140 #define RXC_MFB 0x0300 ///< Maximum frame burst
141 #define RXC_MFB_2048 0 ///< Maximum frame size: 2048 bytes
142 #define RXC_MFB_4096 0x0100 ///< Maximum frame size: 4096 bytes
143 #define RXC_MFB_8192 0x0200 ///< Maximum frame size: 8192 bytes
144 #define RXC_MFB_16384 0x0300 ///< Maximum frame size: 16384 bytes
147 // Medium Status register
150 #define MS_FD 0x0002 ///< Full duplex
151 #define MS_ONE 0x0004 ///< Must be one
152 #define MS_RFC 0x0010 ///< RX flow control enable
153 #define MS_TFC 0x0020 ///< TX flow control enable
154 #define MS_PF 0x0080 ///< Pause frame enable
155 #define MS_RE 0x0100 ///< Receive enable
156 #define MS_PS 0x0200 ///< Port speed 1=100, 0=10 Mbps
157 #define MS_SBP 0x0800 ///< Stop back pressure
158 #define MS_SM 0x1000 ///< Super MAC support
161 // Software PHY Select register
164 #define SPHY_PSEL 0x01 ///< Select internal PHY
165 #define SPHY_ASEL 0x02 ///< 1=Auto select, 0=Manual select
168 // Software Reset register
171 #define SRR_RR 0x01 ///< Clear receive frame length error
172 #define SRR_RT 0x02 ///< Clear transmit frame length error
173 #define SRR_PRTE 0x04 ///< External PHY reset pin tri-state enable
174 #define SRR_PRL 0x08 ///< External PHY reset pin level
175 #define SRR_BZ 0x10 ///< Force Bulk to return zero length packet
176 #define SRR_IPRL 0x20 ///< Internal PHY reset control
177 #define SRR_IPPD 0x40 ///< Internal PHY power down
183 #define PHY_ID_INTERNAL 0x0010 ///< Internal PHY
189 #define CMD_PHY_ACCESS_SOFTWARE 0x06 ///< Software in control of PHY
190 #define CMD_PHY_REG_READ 0x07 ///< Read PHY register, Value: PHY, Index: Register, Data: Register value
191 #define CMD_PHY_REG_WRITE 0x08 ///< Write PHY register, Value: PHY, Index: Register, Data: New 16-bit value
192 #define CMD_PHY_ACCESS_HARDWARE 0x0a ///< Hardware in control of PHY
193 #define CMD_SROM_READ 0x0b ///< Read SROM register: Value: Address, Data: Value
194 #define CMD_RX_CONTROL_WRITE 0x10 ///< Set the RX control register, Value: New value
195 #define CMD_GAPS_WRITE 0x12 ///< Write the gaps register, Value: New value
196 #define CMD_MAC_ADDRESS_READ 0x13 ///< Read the MAC address, Data: 6 byte MAC address
197 #define CMD_MAC_ADDRESS_WRITE 0x14 ///< Set the MAC address, Data: New 6 byte MAC address
198 #define CMD_MULTICAST_HASH_WRITE 0x16 ///< Write the multicast hash table, Data: New 8 byte value
199 #define CMD_MEDIUM_STATUS_READ 0x1a ///< Read medium status register, Data: Register value
200 #define CMD_MEDIUM_STATUS_WRITE 0x1b ///< Write medium status register, Value: New value
201 #define CMD_RESET 0x20 ///< Reset register, Value: New value
202 #define CMD_PHY_SELECT 0x22 ///< PHY select register, Value: New value
204 //------------------------------
206 //------------------------------
208 #define CONTROL_ENDPOINT 0 ///< Control endpoint
209 #define INTERRUPT_ENDPOINT 1 ///< Interrupt endpoint
210 #define BULK_IN_ENDPOINT 2 ///< Receive endpoint
211 #define BULK_OUT_ENDPOINT 3 ///< Transmit endpoint
213 //------------------------------
215 //------------------------------
217 #define PHY_BMCR 0 ///< Control register
218 #define PHY_BMSR 1 ///< Status register
219 #define PHY_ANAR 4 ///< Autonegotiation advertisement register
220 #define PHY_ANLPAR 5 ///< Autonegotiation link parter ability register
221 #define PHY_ANER 6 ///< Autonegotiation expansion register
225 #define BMCR_RESET 0x8000 ///< 1 = Reset the PHY, bit clears after reset
226 #define BMCR_LOOPBACK 0x4000 ///< 1 = Loopback enabled
227 #define BMCR_100MBPS 0x2000 ///< 100 Mbits/Sec
228 #define BMCR_10MBPS 0 ///< 10 Mbits/Sec
229 #define BMCR_AUTONEGOTIATION_ENABLE 0x1000 ///< 1 = Enable autonegotiation
230 #define BMCR_POWER_DOWN 0x0800 ///< 1 = Power down
231 #define BMCR_ISOLATE 0x0400 ///< 0 = Isolate PHY
232 #define BMCR_RESTART_AUTONEGOTIATION 0x0200 ///< 1 = Restart autonegotiation
233 #define BMCR_FULL_DUPLEX 0x0100 ///< Full duplex operation
234 #define BMCR_HALF_DUPLEX 0 ///< Half duplex operation
235 #define BMCR_COLLISION_TEST 0x0080 ///< 1 = Collision test enabled
239 #define BMSR_100BASET4 0x8000 ///< 1 = 100BASE-T4 mode
240 #define BMSR_100BASETX_FDX 0x4000 ///< 1 = 100BASE-TX full duplex
241 #define BMSR_100BASETX_HDX 0x2000 ///< 1 = 100BASE-TX half duplex
242 #define BMSR_10BASET_FDX 0x1000 ///< 1 = 10BASE-T full duplex
243 #define BMSR_10BASET_HDX 0x0800 ///< 1 = 10BASE-T half duplex
244 #define BMSR_MF 0x0040 ///< 1 = PHY accepts frames with preamble suppressed
245 #define BMSR_AUTONEG_CMPLT 0x0020 ///< 1 = Autonegotiation complete
246 #define BMSR_RF 0x0010 ///< 1 = Remote fault
247 #define BMSR_AUTONEG 0x0008 ///< 1 = Able to perform autonegotiation
248 #define BMSR_LINKST 0x0004 ///< 1 = Link up
249 #define BMSR_JABBER_DETECT 0x0002 ///< 1 = jabber condition detected
250 #define BMSR_EXTENDED_CAPABILITY 0x0001 ///< 1 = Extended register capable
252 // ANAR and ANLPAR Registers 4, 5
254 #define AN_NP 0x8000 ///< 1 = Next page available
255 #define AN_ACK 0x4000 ///< 1 = Link partner acknowledged
256 #define AN_RF 0x2000 ///< 1 = Remote fault indicated by link partner
257 #define AN_FCS 0x0400 ///< 1 = Flow control ability
258 #define AN_T4 0x0200 ///< 1 = 100BASE-T4 support
259 #define AN_TX_FDX 0x0100 ///< 1 = 100BASE-TX Full duplex
260 #define AN_TX_HDX 0x0080 ///< 1 = 100BASE-TX support
261 #define AN_10_FDX 0x0040 ///< 1 = 10BASE-T Full duplex
262 #define AN_10_HDX 0x0020 ///< 1 = 10BASE-T support
263 #define AN_CSMA_CD 0x0001 ///< 1 = IEEE 802.3 CSMA/CD support
265 //------------------------------------------------------------------------------
267 //------------------------------------------------------------------------------
270 Ethernet header layout
272 IEEE 802.3-2002 Part 3 specification, section 3.1.1.
276 UINT8 dest_addr
[PXE_HWADDR_LEN_ETHER
]; ///< Destination LAN address
277 UINT8 src_addr
[PXE_HWADDR_LEN_ETHER
]; ///< Source LAN address
278 UINT16 type
; ///< Protocol or length
283 Receive and Transmit packet structure
286 typedef struct _RX_TX_PACKET
{
287 struct _RX_TX_PACKET
* pNext
; ///< Next receive packet
288 UINT16 Length
; ///< Packet length
289 UINT16 LengthBar
; ///< Complement of the length
290 UINT8 Data
[ AX88772_MAX_PKT_SIZE
]; ///< Received packet data
295 AX88772 control structure
297 The driver uses this structure to manage the Asix AX88772 10/100
301 UINTN Signature
; ///< Structure identification
306 EFI_HANDLE Controller
; ///< Controller handle
307 EFI_USB_IO_PROTOCOL
* pUsbIo
; ///< USB driver interface
310 // Simple network protocol data
312 EFI_SIMPLE_NETWORK_PROTOCOL SimpleNetwork
; ///< Driver's network stack interface
313 EFI_SIMPLE_NETWORK_MODE SimpleNetworkData
; ///< Data for simple network
316 // Ethernet controller data
318 BOOLEAN bInitialized
; ///< Controller initialized
319 VOID
* pTxBuffer
; ///< Last transmit buffer
320 UINT16 PhyId
; ///< PHY ID
325 BOOLEAN b100Mbps
; ///< Current link speed, FALSE = 10 Mbps
326 BOOLEAN bComplete
; ///< Current state of auto-negotiation
327 BOOLEAN bFullDuplex
; ///< Current duplex
328 BOOLEAN bLinkUp
; ///< Current link state
329 BOOLEAN bLinkIdle
; ///< TRUE = No received traffic
330 EFI_EVENT Timer
; ///< Timer to monitor link state and receive packets
331 UINTN PollCount
; ///< Number of times the autonegotiation status was polled
334 // Receive buffer list
336 RX_TX_PACKET
* pRxHead
; ///< Head of receive packet list
337 RX_TX_PACKET
* pRxTail
; ///< Tail of receive packet list
338 RX_TX_PACKET
* pRxFree
; ///< Free packet list
339 INT32 MulticastHash
[2]; ///< Hash table for multicast destination addresses
340 UINT8
* pBulkInBuff
; ///< Buffer for Usb Bulk
343 #define DEV_FROM_SIMPLE_NETWORK(a) CR (a, NIC_DEVICE, SimpleNetwork, DEV_SIGNATURE) ///< Locate NIC_DEVICE from Simple Network Protocol
345 //------------------------------------------------------------------------------
346 // Simple Network Protocol
347 //------------------------------------------------------------------------------
350 Reset the network adapter.
352 Resets a network adapter and reinitializes it with the parameters that
353 were provided in the previous call to Initialize (). The transmit and
354 receive queues are cleared. Receive filters, the station address, the
355 statistics, and the multicast-IP-to-HW MAC addresses are not reset by
358 This routine calls ::Ax88772Reset to perform the adapter specific
359 reset operation. This routine also starts the link negotiation
360 by calling ::Ax88772NegotiateLinkStart.
362 @param [in] pSimpleNetwork Protocol instance pointer
363 @param [in] bExtendedVerification Indicates that the driver may perform a more
364 exhaustive verification operation of the device
367 @retval EFI_SUCCESS This operation was successful.
368 @retval EFI_NOT_STARTED The network interface was not started.
369 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
370 EFI_SIMPLE_NETWORK_PROTOCOL structure.
371 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
372 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
378 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
379 IN BOOLEAN bExtendedVerification
383 Initialize the simple network protocol.
385 This routine calls ::Ax88772MacAddressGet to obtain the
388 @param [in] pNicDevice NIC_DEVICE_INSTANCE pointer
390 @retval EFI_SUCCESS Setup was successful
395 IN NIC_DEVICE
* pNicDevice
399 This routine starts the network interface.
401 @param [in] pSimpleNetwork Protocol instance pointer
403 @retval EFI_SUCCESS This operation was successful.
404 @retval EFI_ALREADY_STARTED The network interface was already started.
405 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
406 EFI_SIMPLE_NETWORK_PROTOCOL structure.
407 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
408 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
414 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
420 This function modifies or resets the current station address of a
421 network interface. If Reset is TRUE, then the current station address
422 is set ot the network interface's permanent address. If Reset if FALSE
423 then the current station address is changed to the address specified by
426 This routine calls ::Ax88772MacAddressSet to update the MAC address
427 in the network adapter.
429 @param [in] pSimpleNetwork Protocol instance pointer
430 @param [in] bReset Flag used to reset the station address to the
431 network interface's permanent address.
432 @param [in] pNew New station address to be used for the network
435 @retval EFI_SUCCESS This operation was successful.
436 @retval EFI_NOT_STARTED The network interface was not started.
437 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
438 EFI_SIMPLE_NETWORK_PROTOCOL structure.
439 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
440 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
446 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
448 IN EFI_MAC_ADDRESS
* pNew
452 This function resets or collects the statistics on a network interface.
453 If the size of the statistics table specified by StatisticsSize is not
454 big enough for all of the statistics that are collected by the network
455 interface, then a partial buffer of statistics is returned in
458 @param [in] pSimpleNetwork Protocol instance pointer
459 @param [in] bReset Set to TRUE to reset the statistics for the network interface.
460 @param [in, out] pStatisticsSize On input the size, in bytes, of StatisticsTable. On output
461 the size, in bytes, of the resulting table of statistics.
462 @param [out] pStatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
463 conains the statistics.
465 @retval EFI_SUCCESS This operation was successful.
466 @retval EFI_NOT_STARTED The network interface was not started.
467 @retval EFI_BUFFER_TOO_SMALL The pStatisticsTable is NULL or the buffer is too small.
468 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
469 EFI_SIMPLE_NETWORK_PROTOCOL structure.
470 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
471 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
477 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
479 IN OUT UINTN
* pStatisticsSize
,
480 OUT EFI_NETWORK_STATISTICS
* pStatisticsTable
484 This function stops a network interface. This call is only valid
485 if the network interface is in the started state.
487 @param [in] pSimpleNetwork Protocol instance pointer
489 @retval EFI_SUCCESS This operation was successful.
490 @retval EFI_NOT_STARTED The network interface was not started.
491 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
492 EFI_SIMPLE_NETWORK_PROTOCOL structure.
493 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
494 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
500 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
504 This function releases the memory buffers assigned in the Initialize() call.
505 Pending transmits and receives are lost, and interrupts are cleared and disabled.
506 After this call, only Initialize() and Stop() calls may be used.
508 @param [in] pSimpleNetwork Protocol instance pointer
510 @retval EFI_SUCCESS This operation was successful.
511 @retval EFI_NOT_STARTED The network interface was not started.
512 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
513 EFI_SIMPLE_NETWORK_PROTOCOL structure.
514 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
515 @retval EFI_UNSUPPORTED The increased buffer size feature is not supported.
521 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
525 Send a packet over the network.
527 This function places the packet specified by Header and Buffer on
528 the transmit queue. This function performs a non-blocking transmit
529 operation. When the transmit is complete, the buffer is returned
530 via the GetStatus() call.
532 This routine calls ::Ax88772Rx to empty the network adapter of
533 receive packets. The routine then passes the transmit packet
534 to the network adapter.
536 @param [in] pSimpleNetwork Protocol instance pointer
537 @param [in] HeaderSize The size, in bytes, of the media header to be filled in by
538 the Transmit() function. If HeaderSize is non-zero, then
539 it must be equal to SimpleNetwork->Mode->MediaHeaderSize
540 and DestAddr and Protocol parameters must not be NULL.
541 @param [in] BufferSize The size, in bytes, of the entire packet (media header and
542 data) to be transmitted through the network interface.
543 @param [in] pBuffer A pointer to the packet (media header followed by data) to
544 to be transmitted. This parameter can not be NULL. If
545 HeaderSize is zero, then the media header is Buffer must
546 already be filled in by the caller. If HeaderSize is nonzero,
547 then the media header will be filled in by the Transmit()
549 @param [in] pSrcAddr The source HW MAC address. If HeaderSize is zero, then
550 this parameter is ignored. If HeaderSize is nonzero and
551 SrcAddr is NULL, then SimpleNetwork->Mode->CurrentAddress
552 is used for the source HW MAC address.
553 @param [in] pDestAddr The destination HW MAC address. If HeaderSize is zero, then
554 this parameter is ignored.
555 @param [in] pProtocol The type of header to build. If HeaderSize is zero, then
556 this parameter is ignored.
558 @retval EFI_SUCCESS This operation was successful.
559 @retval EFI_NOT_STARTED The network interface was not started.
560 @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.
561 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
562 @retval EFI_INVALID_PARAMETER pSimpleNetwork parameter was NULL or did not point to a valid
563 EFI_SIMPLE_NETWORK_PROTOCOL structure.
564 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
570 IN EFI_SIMPLE_NETWORK_PROTOCOL
* pSimpleNetwork
,
574 IN EFI_MAC_ADDRESS
* pSrcAddr
,
575 IN EFI_MAC_ADDRESS
* pDestAddr
,
576 IN UINT16
* pProtocol
579 //------------------------------------------------------------------------------
581 //------------------------------------------------------------------------------
586 This routine calls ::Ax88772UsbCommand to request the MAC
587 address from the network adapter.
589 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
590 @param [out] pMacAddress Address of a six byte buffer to receive the MAC address.
592 @retval EFI_SUCCESS The MAC address is available.
593 @retval other The MAC address is not valid.
597 Ax88772MacAddressGet (
598 IN NIC_DEVICE
* pNicDevice
,
599 OUT UINT8
* pMacAddress
605 This routine calls ::Ax88772UsbCommand to set the MAC address
606 in the network adapter.
608 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
609 @param [in] pMacAddress Address of a six byte buffer to containing the new MAC address.
611 @retval EFI_SUCCESS The MAC address was set.
612 @retval other The MAC address was not set.
616 Ax88772MacAddressSet (
617 IN NIC_DEVICE
* pNicDevice
,
618 IN UINT8
* pMacAddress
622 Clear the multicast hash table
624 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
628 Ax88772MulticastClear (
629 IN NIC_DEVICE
* pNicDevice
633 Enable a multicast address in the multicast hash table
635 This routine calls ::Ax88772Crc to compute the hash bit for
638 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
639 @param [in] pMacAddress Address of a six byte buffer to containing the MAC address.
643 Ax88772MulticastSet (
644 IN NIC_DEVICE
* pNicDevice
,
645 IN UINT8
* pMacAddress
649 Start the link negotiation
651 This routine calls ::Ax88772PhyWrite to start the PHY's link
654 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
656 @retval EFI_SUCCESS The link negotiation was started.
657 @retval other Failed to start the link negotiation.
661 Ax88772NegotiateLinkStart (
662 IN NIC_DEVICE
* pNicDevice
666 Complete the negotiation of the PHY link
668 This routine calls ::Ax88772PhyRead to determine if the
669 link negotiation is complete.
671 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
672 @param [in, out] pPollCount Address of number of times this routine was polled
673 @param [out] pbComplete Address of boolean to receive complate status.
674 @param [out] pbLinkUp Address of boolean to receive link status, TRUE=up.
675 @param [out] pbHiSpeed Address of boolean to receive link speed, TRUE=100Mbps.
676 @param [out] pbFullDuplex Address of boolean to receive link duplex, TRUE=full.
678 @retval EFI_SUCCESS The MAC address is available.
679 @retval other The MAC address is not valid.
683 Ax88772NegotiateLinkComplete (
684 IN NIC_DEVICE
* pNicDevice
,
685 IN OUT UINTN
* pPollCount
,
686 OUT BOOLEAN
* pbComplete
,
687 OUT BOOLEAN
* pbLinkUp
,
688 OUT BOOLEAN
* pbHiSpeed
,
689 OUT BOOLEAN
* pbFullDuplex
693 Read a register from the PHY
695 This routine calls ::Ax88772UsbCommand to read a PHY register.
697 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
698 @param [in] RegisterAddress Number of the register to read.
699 @param [in, out] pPhyData Address of a buffer to receive the PHY register value
701 @retval EFI_SUCCESS The PHY data is available.
702 @retval other The PHY data is not valid.
707 IN NIC_DEVICE
* pNicDevice
,
708 IN UINT8 RegisterAddress
,
709 IN OUT UINT16
* pPhyData
713 Write to a PHY register
715 This routine calls ::Ax88772UsbCommand to write a PHY register.
717 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
718 @param [in] RegisterAddress Number of the register to read.
719 @param [in] PhyData Address of a buffer to receive the PHY register value
721 @retval EFI_SUCCESS The PHY data was written.
722 @retval other Failed to wwrite the PHY register.
727 IN NIC_DEVICE
* pNicDevice
,
728 IN UINT8 RegisterAddress
,
735 This routine uses ::Ax88772UsbCommand to reset the network
736 adapter. This routine also uses ::Ax88772PhyWrite to reset
739 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
741 @retval EFI_SUCCESS The MAC address is available.
742 @retval other The MAC address is not valid.
747 IN NIC_DEVICE
* pNicDevice
751 Receive a frame from the network.
753 This routine polls the USB receive interface for a packet. If a packet
754 is available, this routine adds the receive packet to the list of
755 pending receive packets.
757 This routine calls ::Ax88772NegotiateLinkComplete to verify
758 that the link is up. This routine also calls ::SN_Reset to
759 reset the network adapter when necessary. Finally this
760 routine attempts to receive one or more packets from the
763 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
764 @param [in] bUpdateLink TRUE = Update link status
769 IN NIC_DEVICE
* pNicDevice
,
770 IN BOOLEAN bUpdateLink
774 Enable or disable the receiver
776 This routine calls ::Ax88772UsbCommand to update the
777 receiver state. This routine also calls ::Ax88772MacAddressSet
778 to establish the MAC address for the network adapter.
780 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
781 @param [in] RxFilter Simple network RX filter mask value
783 @retval EFI_SUCCESS The MAC address was set.
784 @retval other The MAC address was not set.
789 IN NIC_DEVICE
* pNicDevice
,
794 Read an SROM location
796 This routine calls ::Ax88772UsbCommand to read data from the
799 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
800 @param [in] Address SROM address
801 @param [out] pData Buffer to receive the data
803 @retval EFI_SUCCESS The read was successful
804 @retval other The read failed
809 IN NIC_DEVICE
* pNicDevice
,
815 This routine is called at a regular interval to poll for
818 This routine polls the link state and gets any receive packets
819 by calling ::Ax88772Rx.
821 @param [in] Event Timer event
822 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
828 IN NIC_DEVICE
* pNicDevice
832 Send a command to the USB device.
834 @param [in] pNicDevice Pointer to the NIC_DEVICE structure
835 @param [in] pRequest Pointer to the request structure
836 @param [in, out] pBuffer Data buffer address
838 @retval EFI_SUCCESS The USB transfer was successful
839 @retval other The USB transfer failed
844 IN NIC_DEVICE
* pNicDevice
,
845 IN USB_DEVICE_REQUEST
* pRequest
,
846 IN OUT VOID
* pBuffer
849 //------------------------------------------------------------------------------
850 // EFI Component Name Protocol Support
851 //------------------------------------------------------------------------------
853 extern EFI_COMPONENT_NAME_PROTOCOL gComponentName
; ///< Component name protocol declaration
854 extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2
; ///< Component name 2 protocol declaration
857 Retrieves a Unicode string that is the user readable name of the driver.
859 This function retrieves the user readable name of a driver in the form of a
860 Unicode string. If the driver specified by This has a user readable name in
861 the language specified by Language, then a pointer to the driver name is
862 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
863 by This does not support the language specified by Language,
864 then EFI_UNSUPPORTED is returned.
866 @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
867 EFI_COMPONENT_NAME_PROTOCOL instance.
868 @param [in] pLanguage A pointer to a Null-terminated ASCII string
869 array indicating the language. This is the
870 language of the driver name that the caller is
871 requesting, and it must match one of the
872 languages specified in SupportedLanguages. The
873 number of languages supported by a driver is up
874 to the driver writer. Language is specified
875 in RFC 3066 or ISO 639-2 language code format.
876 @param [out] ppDriverName A pointer to the Unicode string to return.
877 This Unicode string is the name of the
878 driver specified by This in the language
879 specified by Language.
881 @retval EFI_SUCCESS The Unicode string for the Driver specified by
882 This and the language specified by Language was
883 returned in DriverName.
884 @retval EFI_INVALID_PARAMETER Language is NULL.
885 @retval EFI_INVALID_PARAMETER DriverName is NULL.
886 @retval EFI_UNSUPPORTED The driver specified by This does not support
887 the language specified by Language.
893 IN EFI_COMPONENT_NAME_PROTOCOL
* pThis
,
894 IN CHAR8
* pLanguage
,
895 OUT CHAR16
** ppDriverName
900 Retrieves a Unicode string that is the user readable name of the controller
901 that is being managed by a driver.
903 This function retrieves the user readable name of the controller specified by
904 ControllerHandle and ChildHandle in the form of a Unicode string. If the
905 driver specified by This has a user readable name in the language specified by
906 Language, then a pointer to the controller name is returned in ControllerName,
907 and EFI_SUCCESS is returned. If the driver specified by This is not currently
908 managing the controller specified by ControllerHandle and ChildHandle,
909 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
910 support the language specified by Language, then EFI_UNSUPPORTED is returned.
912 @param [in] pThis A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
913 EFI_COMPONENT_NAME_PROTOCOL instance.
914 @param [in] ControllerHandle The handle of a controller that the driver
915 specified by This is managing. This handle
916 specifies the controller whose name is to be
918 @param [in] ChildHandle The handle of the child controller to retrieve
919 the name of. This is an optional parameter that
920 may be NULL. It will be NULL for device
921 drivers. It will also be NULL for a bus drivers
922 that wish to retrieve the name of the bus
923 controller. It will not be NULL for a bus
924 driver that wishes to retrieve the name of a
926 @param [in] pLanguage A pointer to a Null-terminated ASCII string
927 array indicating the language. This is the
928 language of the driver name that the caller is
929 requesting, and it must match one of the
930 languages specified in SupportedLanguages. The
931 number of languages supported by a driver is up
932 to the driver writer. Language is specified in
933 RFC 3066 or ISO 639-2 language code format.
934 @param [out] ppControllerName A pointer to the Unicode string to return.
935 This Unicode string is the name of the
936 controller specified by ControllerHandle and
937 ChildHandle in the language specified by
938 Language from the point of view of the driver
941 @retval EFI_SUCCESS The Unicode string for the user readable name in
942 the language specified by Language for the
943 driver specified by This was returned in
945 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
946 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
948 @retval EFI_INVALID_PARAMETER Language is NULL.
949 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
950 @retval EFI_UNSUPPORTED The driver specified by This is not currently
951 managing the controller specified by
952 ControllerHandle and ChildHandle.
953 @retval EFI_UNSUPPORTED The driver specified by This does not support
954 the language specified by Language.
960 IN EFI_COMPONENT_NAME_PROTOCOL
* pThis
,
961 IN EFI_HANDLE ControllerHandle
,
962 IN OPTIONAL EFI_HANDLE ChildHandle
,
963 IN CHAR8
* pLanguage
,
964 OUT CHAR16
** ppControllerName
967 //------------------------------------------------------------------------------
969 #endif // _AX88772_H_