iPXE
eepro100.h File Reference

Go to the source code of this file.

Data Structures

struct  ifec_stats
struct  ifec_tcb
struct  ifec_rfd
struct  ifec_ias
struct  ifec_cfg
struct  ifec_private

Macros

#define CONGENB   0 /* Enable congestion control in the DP83840. */
#define TX_FIFO   8 /* Tx FIFO threshold in 4 byte units, 0-15 */
#define RX_FIFO   8 /* Rx FIFO threshold, default 32 bytes. */
#define TX_DMA_COUNT   0 /* Tx DMA burst length, 0-127, default 0. */
#define RX_DMA_COUNT   0 /* Rx DMA length, 0 means no preemption. */
#define CU_CMD_TIMEOUT   1000 /* CU command accept timeout in microseconds */
#define LINK_CHECK_PERIOD   1000 /* # of poll() calls between link checks */
#define RFD_PACKET_LEN   1518
#define RFD_IOB_LEN   1536
#define RFD_HEADER_LEN   16
#define CB_ALIGN   2 /* Alignment of command blocks */
#define RFD_COUNT   4
#define TCB_COUNT   4
#define RX_RING_BYTES   ( RFD_COUNT * sizeof ( struct ifec_rfd ) )
#define TX_RING_BYTES   ( TCB_COUNT * sizeof ( struct ifec_tcb ) )
#define EEPROM_ADDR_MAC_0   0
#define EEPROM_ADDR_MDIO_REGISTER   6
#define EE_SHIFT_CLK   0x01 /* EEPROM shift clock. */
#define EE_CS   0x02 /* EEPROM chip select. */
#define EE_DATA_WRITE   0x04 /* EEPROM chip data in. */
#define EE_DATA_READ   0x08 /* EEPROM chip data out. */
#define EE_ENB   ( 0x4800 | EE_CS )

Enumerations

enum  CSROffsets {
  SCBStatus =0 , SCBCmd =2 , SCBPointer = 4 , CSRPort =8 ,
  CSRFlash =12 , CSREeprom = 14 , CSRCtrlMDI =16 , CSREarlyRx =20
}
enum  SCBCmdBits {
  SCBMaskCmdDone =0x8000 , SCBMaskRxDone =0x4000 , SCBMaskCmdIdle =0x2000 , SCBMaskRxSuspend =0x1000 ,
  SCBMaskEarlyRx =0x0800 , SCBMaskFlowCtl =0x0400 , SCBTriggerIntr =0x0200 , SCBMaskAll =0x0100 ,
  CUStart =0x0010 , CUResume =0x0020 , CUStatsAddr =0x0040 , CUShowStats =0x0050 ,
  CUCmdBase =0x0060 , CUDumpStats =0x0070 , RUStart =0x0001 , RUResume =0x0002 ,
  RUAbort =0x0004 , RUAddrLoad =0x0006 , RUResumeNoResources =0x0007
}
enum  SCBPortCmds { PortReset =0 , PortSelfTest =1 , PortPartialReset =2 , PortDump =3 }
enum  ActionCommands {
  CmdNOp = 0 , CmdIASetup = 1 , CmdConfigure = 2 , CmdMulticastList = 3 ,
  CmdTx = 4 , CmdTDR = 5 , CmdDump = 6 , CmdDiagnose = 7 ,
  CmdEndOfList = 0x8000 , CmdSuspend = 0x4000 , CmdIntr = 0x2000 , CmdTxFlex = 0x0008
}
enum  TCBBits { TCB_C =0x8000 , TCB_OK =0x2000 , TCB_U =0x1000 }
enum  RFDBits {
  RFDRxCol =0x0001 , RFDIAMatch =0x0002 , RFDNoMatch =0x0004 , RFDReserved3 =0x0008 ,
  RFDRxErr =0x0010 , RFDEthType =0x0020 , RFDReserved6 =0x0040 , RFDShort =0x0080 ,
  RFDDMAOverrun =0x0100 , RFDNoBufs =0x0200 , RFDCRCAlign =0x0400 , RFDCRCError =0x0800 ,
  RFDReserved12 =0x1000 , RFD_OK =0x2000 , RFDComplete =0x8000 , RFDMaskCount =0x3FFF
}
enum  phy_chips {
  NonSuchPhy =0 , I82553AB , I82553C , I82503 ,
  DP83840 , S80C240 , S80C24 , PhyUndefined ,
  DP83840A =10
}

Functions

 FILE_LICENCE (GPL2_OR_LATER)
static int ifec_pci_probe (struct pci_device *pci)
static void ifec_pci_remove (struct pci_device *pci)
static void ifec_net_close (struct net_device *)
static void ifec_net_irq (struct net_device *, int enable)
static int ifec_net_open (struct net_device *)
static void ifec_net_poll (struct net_device *)
static int ifec_net_transmit (struct net_device *, struct io_buffer *iobuf)
static void ifec_init_eeprom (struct net_device *)
static int ifec_mdio_read (struct net_device *, int phy, int location)
static void ifec_mdio_setup (struct net_device *, int options)
static int ifec_mdio_write (struct net_device *, int phy, int loc, int val)
static void ifec_reset (struct net_device *)
static void ifec_free (struct net_device *)
static void ifec_rfd_init (struct ifec_rfd *rfd, s16 command, u32 link)
static void ifec_rx_process (struct net_device *)
static void ifec_reprime_ru (struct net_device *)
static void ifec_check_ru_status (struct net_device *, unsigned short)
static int ifec_get_rx_desc (struct net_device *, int, int, int)
static void ifec_refill_rx_ring (struct net_device *)
static int ifec_rx_setup (struct net_device *)
static int ifec_scb_cmd (struct net_device *, u32 ptr, u8 cmd)
static int ifec_scb_cmd_wait (struct net_device *)
static void ifec_tx_process (struct net_device *)
static int ifec_tx_setup (struct net_device *)
static void ifec_tx_wake (struct net_device *)

Macro Definition Documentation

◆ CONGENB

#define CONGENB   0 /* Enable congestion control in the DP83840. */

Definition at line 7 of file eepro100.h.

Referenced by ifec_mdio_setup().

◆ TX_FIFO

#define TX_FIFO   8 /* Tx FIFO threshold in 4 byte units, 0-15 */

Definition at line 8 of file eepro100.h.

Referenced by t515_transmit().

◆ RX_FIFO

#define RX_FIFO   8 /* Rx FIFO threshold, default 32 bytes. */

Definition at line 9 of file eepro100.h.

Referenced by t515_poll().

◆ TX_DMA_COUNT

#define TX_DMA_COUNT   0 /* Tx DMA burst length, 0-127, default 0. */

Definition at line 10 of file eepro100.h.

◆ RX_DMA_COUNT

#define RX_DMA_COUNT   0 /* Rx DMA length, 0 means no preemption. */

Definition at line 11 of file eepro100.h.

◆ CU_CMD_TIMEOUT

#define CU_CMD_TIMEOUT   1000 /* CU command accept timeout in microseconds */

Definition at line 12 of file eepro100.h.

Referenced by ifec_scb_cmd_wait().

◆ LINK_CHECK_PERIOD

#define LINK_CHECK_PERIOD   1000 /* # of poll() calls between link checks */

Definition at line 13 of file eepro100.h.

◆ RFD_PACKET_LEN

#define RFD_PACKET_LEN   1518

Definition at line 15 of file eepro100.h.

Referenced by ifec_rfd_init().

◆ RFD_IOB_LEN

#define RFD_IOB_LEN   1536

Definition at line 16 of file eepro100.h.

◆ RFD_HEADER_LEN

#define RFD_HEADER_LEN   16

Definition at line 17 of file eepro100.h.

Referenced by ifec_get_rx_desc().

◆ CB_ALIGN

#define CB_ALIGN   2 /* Alignment of command blocks */

Definition at line 18 of file eepro100.h.

Referenced by ifec_net_open(), and ifec_tx_setup().

◆ RFD_COUNT

#define RFD_COUNT   4

Definition at line 20 of file eepro100.h.

Referenced by ifec_free(), ifec_refill_rx_ring(), ifec_rx_process(), and ifec_rx_setup().

◆ TCB_COUNT

#define TCB_COUNT   4

Definition at line 21 of file eepro100.h.

Referenced by ifec_tx_setup().

◆ RX_RING_BYTES

#define RX_RING_BYTES   ( RFD_COUNT * sizeof ( struct ifec_rfd ) )

◆ TX_RING_BYTES

#define TX_RING_BYTES   ( TCB_COUNT * sizeof ( struct ifec_tcb ) )

◆ EEPROM_ADDR_MAC_0

#define EEPROM_ADDR_MAC_0   0

Definition at line 26 of file eepro100.h.

Referenced by ifec_pci_probe().

◆ EEPROM_ADDR_MDIO_REGISTER

#define EEPROM_ADDR_MDIO_REGISTER   6

Definition at line 27 of file eepro100.h.

Referenced by ifec_pci_probe().

◆ EE_SHIFT_CLK

#define EE_SHIFT_CLK   0x01 /* EEPROM shift clock. */

Definition at line 89 of file eepro100.h.

◆ EE_CS

#define EE_CS   0x02 /* EEPROM chip select. */

Definition at line 90 of file eepro100.h.

◆ EE_DATA_WRITE

#define EE_DATA_WRITE   0x04 /* EEPROM chip data in. */

Definition at line 91 of file eepro100.h.

◆ EE_DATA_READ

#define EE_DATA_READ   0x08 /* EEPROM chip data out. */

Definition at line 92 of file eepro100.h.

◆ EE_ENB

#define EE_ENB   ( 0x4800 | EE_CS )

Definition at line 93 of file eepro100.h.

Enumeration Type Documentation

◆ CSROffsets

enum CSROffsets
Enumerator
SCBStatus 
SCBCmd 
SCBPointer 
CSRPort 
CSRFlash 
CSREeprom 
CSRCtrlMDI 
CSREarlyRx 

Definition at line 30 of file eepro100.h.

30 {
31 SCBStatus=0, SCBCmd=2, SCBPointer = 4,
32 CSRPort=8, CSRFlash=12, CSREeprom = 14,
34};
@ CSRPort
Definition eepro100.h:32
@ CSREeprom
Definition eepro100.h:32
@ CSRFlash
Definition eepro100.h:32
@ CSREarlyRx
Definition eepro100.h:33
@ SCBStatus
Definition eepro100.h:31
@ SCBCmd
Definition eepro100.h:31
@ SCBPointer
Definition eepro100.h:31
@ CSRCtrlMDI
Definition eepro100.h:33

◆ SCBCmdBits

enum SCBCmdBits
Enumerator
SCBMaskCmdDone 
SCBMaskRxDone 
SCBMaskCmdIdle 
SCBMaskRxSuspend 
SCBMaskEarlyRx 
SCBMaskFlowCtl 
SCBTriggerIntr 
SCBMaskAll 
CUStart 
CUResume 
CUStatsAddr 
CUShowStats 
CUCmdBase 
CUDumpStats 
RUStart 
RUResume 
RUAbort 
RUAddrLoad 
RUResumeNoResources 

Definition at line 37 of file eepro100.h.

37 {
38 /* SCB Interrupt Masks - SDM Table 14 */
39 SCBMaskCmdDone=0x8000, SCBMaskRxDone=0x4000, SCBMaskCmdIdle=0x2000,
40 SCBMaskRxSuspend=0x1000, SCBMaskEarlyRx=0x0800, SCBMaskFlowCtl=0x0400,
41 SCBTriggerIntr=0x0200, SCBMaskAll=0x0100,
42 /* SCB Control Commands - SDM Table 14-16 */
43 CUStart=0x0010, CUResume=0x0020, CUStatsAddr=0x0040,
44 CUShowStats=0x0050, CUCmdBase=0x0060, CUDumpStats=0x0070,
45 RUStart=0x0001, RUResume=0x0002, RUAbort=0x0004,
46 RUAddrLoad=0x0006, RUResumeNoResources=0x0007
47};
@ CUResume
Definition eepro100.h:43
@ CUCmdBase
Definition eepro100.h:44
@ RUResume
Definition eepro100.h:45
@ CUDumpStats
Definition eepro100.h:44
@ RUResumeNoResources
Definition eepro100.h:46
@ RUAbort
Definition eepro100.h:45
@ SCBMaskFlowCtl
Definition eepro100.h:40
@ CUStatsAddr
Definition eepro100.h:43
@ SCBMaskCmdDone
Definition eepro100.h:39
@ SCBTriggerIntr
Definition eepro100.h:41
@ CUShowStats
Definition eepro100.h:44
@ RUAddrLoad
Definition eepro100.h:46
@ SCBMaskRxDone
Definition eepro100.h:39
@ SCBMaskRxSuspend
Definition eepro100.h:40
@ RUStart
Definition eepro100.h:45
@ SCBMaskAll
Definition eepro100.h:41
@ SCBMaskEarlyRx
Definition eepro100.h:40
@ SCBMaskCmdIdle
Definition eepro100.h:39
@ CUStart
Definition eepro100.h:43

◆ SCBPortCmds

Enumerator
PortReset 
PortSelfTest 
PortPartialReset 
PortDump 

Definition at line 49 of file eepro100.h.

49 {
51};
@ PortReset
Definition eepro100.h:50
@ PortPartialReset
Definition eepro100.h:50
@ PortDump
Definition eepro100.h:50
@ PortSelfTest
Definition eepro100.h:50

◆ ActionCommands

Enumerator
CmdNOp 
CmdIASetup 
CmdConfigure 
CmdMulticastList 
CmdTx 
CmdTDR 
CmdDump 
CmdDiagnose 
CmdEndOfList 
CmdSuspend 
CmdIntr 
CmdTxFlex 

Definition at line 54 of file eepro100.h.

54 {
55 CmdNOp = 0, CmdIASetup = 1, CmdConfigure = 2,
56 CmdMulticastList = 3, CmdTx = 4, CmdTDR = 5,
57 CmdDump = 6, CmdDiagnose = 7,
58 /* And some extra flags: */
59 CmdEndOfList = 0x8000,
60 CmdSuspend = 0x4000, CmdIntr = 0x2000, CmdTxFlex = 0x0008
61};
@ CmdIASetup
Definition eepro100.h:55
@ CmdTxFlex
Definition eepro100.h:60
@ CmdTx
Definition eepro100.h:56
@ CmdConfigure
Definition eepro100.h:55
@ CmdSuspend
Definition eepro100.h:60
@ CmdDump
Definition eepro100.h:57
@ CmdMulticastList
Definition eepro100.h:56
@ CmdIntr
Definition eepro100.h:60
@ CmdDiagnose
Definition eepro100.h:57
@ CmdTDR
Definition eepro100.h:56
@ CmdEndOfList
Definition eepro100.h:59
@ CmdNOp
Definition eepro100.h:55

◆ TCBBits

enum TCBBits
Enumerator
TCB_C 
TCB_OK 
TCB_U 

Definition at line 63 of file eepro100.h.

63 {
64 TCB_C=0x8000, TCB_OK=0x2000, TCB_U=0x1000
65};
@ TCB_C
Definition eepro100.h:64
@ TCB_U
Definition eepro100.h:64
@ TCB_OK
Definition eepro100.h:64

◆ RFDBits

enum RFDBits
Enumerator
RFDRxCol 
RFDIAMatch 
RFDNoMatch 
RFDReserved3 
RFDRxErr 
RFDEthType 
RFDReserved6 
RFDShort 
RFDDMAOverrun 
RFDNoBufs 
RFDCRCAlign 
RFDCRCError 
RFDReserved12 
RFD_OK 
RFDComplete 
RFDMaskCount 

Definition at line 67 of file eepro100.h.

67 {
68 /* Status Word Bits */
69 RFDRxCol=0x0001, RFDIAMatch=0x0002, RFDNoMatch=0x0004,
70 RFDReserved3=0x0008, RFDRxErr=0x0010, RFDEthType=0x0020,
71 RFDReserved6=0x0040, RFDShort=0x0080, RFDDMAOverrun=0x0100,
72 RFDNoBufs=0x0200, RFDCRCAlign=0x0400, RFDCRCError=0x0800,
73 RFDReserved12=0x1000, RFD_OK=0x2000, RFDComplete=0x8000,
74 /* Command Word Bits */
75 //RFD_SF=0x0008, RFDSuspend=0x4000, RFDEndOfList=0x8000,
76 /* Other */
77 RFDMaskCount=0x3FFF
78};
@ RFDComplete
Definition eepro100.h:73
@ RFDCRCAlign
Definition eepro100.h:72
@ RFDEthType
Definition eepro100.h:70
@ RFDReserved6
Definition eepro100.h:71
@ RFDShort
Definition eepro100.h:71
@ RFDNoBufs
Definition eepro100.h:72
@ RFDRxErr
Definition eepro100.h:70
@ RFDRxCol
Definition eepro100.h:69
@ RFD_OK
Definition eepro100.h:73
@ RFDReserved12
Definition eepro100.h:73
@ RFDIAMatch
Definition eepro100.h:69
@ RFDCRCError
Definition eepro100.h:72
@ RFDReserved3
Definition eepro100.h:70
@ RFDNoMatch
Definition eepro100.h:69
@ RFDMaskCount
Definition eepro100.h:77
@ RFDDMAOverrun
Definition eepro100.h:71

◆ phy_chips

enum phy_chips
Enumerator
NonSuchPhy 
I82553AB 
I82553C 
I82503 
DP83840 
S80C240 
S80C24 
PhyUndefined 
DP83840A 

Definition at line 80 of file eepro100.h.

80 {
84};
@ DP83840
Definition eepro100.h:82
@ PhyUndefined
Definition eepro100.h:83
@ I82503
Definition eepro100.h:82
@ I82553C
Definition eepro100.h:81
@ S80C240
Definition eepro100.h:82
@ I82553AB
Definition eepro100.h:81
@ S80C24
Definition eepro100.h:83
@ DP83840A
Definition eepro100.h:83
@ NonSuchPhy
Definition eepro100.h:81

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER )

◆ ifec_pci_probe()

int ifec_pci_probe ( struct pci_device * pci)
static

◆ ifec_pci_remove()

void ifec_pci_remove ( struct pci_device * pci)
static

◆ ifec_net_close()

void ifec_net_close ( struct net_device * )
static

◆ ifec_net_irq()

void ifec_net_irq ( struct net_device * ,
int enable )
static

◆ ifec_net_open()

int ifec_net_open ( struct net_device * )
static

◆ ifec_net_poll()

void ifec_net_poll ( struct net_device * )
static

◆ ifec_net_transmit()

int ifec_net_transmit ( struct net_device * ,
struct io_buffer * iobuf )
static

◆ ifec_init_eeprom()

void ifec_init_eeprom ( struct net_device * )
static

◆ ifec_mdio_read()

int ifec_mdio_read ( struct net_device * ,
int phy,
int location )
static

◆ ifec_mdio_setup()

void ifec_mdio_setup ( struct net_device * ,
int options )
static

References options.

◆ ifec_mdio_write()

int ifec_mdio_write ( struct net_device * ,
int phy,
int loc,
int val )
static

References val.

◆ ifec_reset()

void ifec_reset ( struct net_device * )
static

◆ ifec_free()

void ifec_free ( struct net_device * )
static

◆ ifec_rfd_init()

void ifec_rfd_init ( struct ifec_rfd * rfd,
s16 command,
u32 link )
static

References link, and u32.

◆ ifec_rx_process()

void ifec_rx_process ( struct net_device * )
static

◆ ifec_reprime_ru()

void ifec_reprime_ru ( struct net_device * )
static

◆ ifec_check_ru_status()

void ifec_check_ru_status ( struct net_device * ,
unsigned short  )
static

◆ ifec_get_rx_desc()

int ifec_get_rx_desc ( struct net_device * ,
int ,
int ,
int  )
static

◆ ifec_refill_rx_ring()

void ifec_refill_rx_ring ( struct net_device * )
static

◆ ifec_rx_setup()

int ifec_rx_setup ( struct net_device * )
static

◆ ifec_scb_cmd()

int ifec_scb_cmd ( struct net_device * ,
u32 ptr,
u8 cmd )
static

References cmd, u32, and u8.

◆ ifec_scb_cmd_wait()

int ifec_scb_cmd_wait ( struct net_device * )
static

◆ ifec_tx_process()

void ifec_tx_process ( struct net_device * )
static

◆ ifec_tx_setup()

int ifec_tx_setup ( struct net_device * )
static

◆ ifec_tx_wake()

void ifec_tx_wake ( struct net_device * netdev)
static

Definition at line 1073 of file eepro100.c.

1074{
1075 struct ifec_private *priv = netdev->priv;
1076 unsigned long ioaddr = priv->ioaddr;
1077 struct ifec_tcb *tcb = priv->tcb_head->next;
1078
1079 DBGP ( "ifec_tx_wake\n" );
1080
1081 /* For the special case of the first transmit, we issue a START. The
1082 * card won't RESUME after the configure command. */
1083 if ( priv->configured ) {
1084 priv->configured = 0;
1085 ifec_scb_cmd ( netdev, virt_to_bus ( tcb ), CUStart );
1087 return;
1088 }
1089
1090 /* Resume if suspended. */
1091 switch ( ( inw ( ioaddr + SCBStatus ) >> 6 ) & 0x3 ) {
1092 case 0: /* Idle - We should not reach this state. */
1093 DBG2 ( "ifec_tx_wake: tx idle!\n" );
1094 ifec_scb_cmd ( netdev, virt_to_bus ( tcb ), CUStart );
1096 return;
1097 case 1: /* Suspended */
1098 DBG2 ( "s" );
1099 break;
1100 default: /* Active */
1101 DBG2 ( "a" );
1102 }
1104 outl ( 0, ioaddr + SCBPointer );
1105 priv->tcb_head->command &= ~CmdSuspend;
1106 /* Immediately issue Resume command */
1107 outb ( CUResume, ioaddr + SCBCmd );
1109}
static unsigned long ioaddr
Definition davicom.c:129
static int ifec_scb_cmd_wait(struct net_device *netdev)
Definition eepro100.c:965
static int ifec_scb_cmd(struct net_device *netdev, u32 ptr, u8 cmd)
Definition eepro100.c:943
static struct net_device * netdev
Definition gdbudp.c:53
#define DBGP(...)
Definition compiler.h:532
#define DBG2(...)
Definition compiler.h:515
#define inw(io_addr)
Definition io.h:292
#define outb(data, io_addr)
Definition io.h:310
#define outl(data, io_addr)
Definition io.h:330
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition io.h:184
static struct tlan_private * priv
Definition tlan.c:225

References CmdSuspend, CUResume, CUStart, DBG2, DBGP, ifec_scb_cmd(), ifec_scb_cmd_wait(), inw, ioaddr, netdev, outb, outl, priv, SCBCmd, SCBPointer, SCBStatus, and virt_to_bus().

Referenced by ifec_net_transmit().