iPXE
eepro100.h
Go to the documentation of this file.
1
2#ifndef __EEPRO100_H_
3#define __EEPRO100_H_
4
5FILE_LICENCE ( GPL2_OR_LATER );
6
7#define CONGENB 0 /* Enable congestion control in the DP83840. */
8#define TX_FIFO 8 /* Tx FIFO threshold in 4 byte units, 0-15 */
9#define RX_FIFO 8 /* Rx FIFO threshold, default 32 bytes. */
10#define TX_DMA_COUNT 0 /* Tx DMA burst length, 0-127, default 0. */
11#define RX_DMA_COUNT 0 /* Rx DMA length, 0 means no preemption. */
12#define CU_CMD_TIMEOUT 1000 /* CU command accept timeout in microseconds */
13#define LINK_CHECK_PERIOD 1000 /* # of poll() calls between link checks */
14
15#define RFD_PACKET_LEN 1518
16#define RFD_IOB_LEN 1536
17#define RFD_HEADER_LEN 16
18#define CB_ALIGN 2 /* Alignment of command blocks */
19
20#define RFD_COUNT 4
21#define TCB_COUNT 4
22#define RX_RING_BYTES ( RFD_COUNT * sizeof ( struct ifec_rfd ) )
23#define TX_RING_BYTES ( TCB_COUNT * sizeof ( struct ifec_tcb ) )
24
25/* some EEPROM addresses */
26#define EEPROM_ADDR_MAC_0 0
27#define EEPROM_ADDR_MDIO_REGISTER 6
28
29/* Control / Status Register byte offsets - SDM Table 11 */
35
36/* System Control Block Command Word - SDM Table 12 */
38 /* SCB Interrupt Masks - SDM Table 14 */
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,
47};
48
52
53/* Action Commands - SDM Table 14,37 */
58 /* And some extra flags: */
59 CmdEndOfList = 0x8000,
60 CmdSuspend = 0x4000, CmdIntr = 0x2000, CmdTxFlex = 0x0008
61};
62
63enum TCBBits {
64 TCB_C=0x8000, TCB_OK=0x2000, TCB_U=0x1000
65};
66
67enum RFDBits {
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 */
78};
79
85
86/* Serial EEPROM section.
87 A "bit" grungy, but we work our way through bit-by-bit :->. */
88/* EEPROM_Ctrl bits. */
89#define EE_SHIFT_CLK 0x01 /* EEPROM shift clock. */
90#define EE_CS 0x02 /* EEPROM chip select. */
91#define EE_DATA_WRITE 0x04 /* EEPROM chip data in. */
92#define EE_DATA_READ 0x08 /* EEPROM chip data out. */
93#define EE_ENB ( 0x4800 | EE_CS )
94
95/* Elements of the dump_statistics block. This block must be lword aligned. */
105
106struct ifec_tcb { /* A Transmit Command Block & TBD. Must be */
107 volatile s16 status; /* word (even address) aligned */
109 u32 link; /* PHYSICAL next ifec_tcb, doesn't change */
110 u32 tbda_addr; /* TBD Array, points to TBD below */
111 s32 count; /* # of TBD, Tx start thresh., etc. */
112 /* The following constitutes a Transmit Buffer Descriptor (TBD).
113 * TBDs must be aligned on an even address (word-aligned). */
114 u32 tbd_addr0; /* PHYSICAL ptr to Tx data */
115 s32 tbd_size0; /* Length of Tx data */
116 /* Driver-specific data; not part of TCB format. */
117 struct io_buffer *iob; /* Exists from tx() to completion poll() */
118 struct ifec_tcb *next; /* VIRTUAL next ifec_tcb, doesn't change */
119};
120
121struct ifec_rfd { /* A Receive Frame Descriptor. Must be aligned */
122 volatile s16 status; /* on a physical word (even address) */
124 u32 link; /* PHYSICAL next ifec_rfd, doesn't change */
125 u32 rx_buf_addr; /* Unused. Flex rx mode is not documented */
126 u16 count; /* and may be impossible */
129};
130
131struct ifec_ias { /* Individual Address Setup command block. */
132 volatile s16 status; /* Must be word (even address) aligned. */
134 u32 link; /* PHYSICAL next command block to process */
135 u8 ia[6];
136};
137
138struct ifec_cfg { /* The configure command format. */
139 volatile s16 status;
141 u32 link; /* PHYSICAL next command block to process */
142 u8 byte[22]; /* 22 configuration bytes */
143};
144
146 unsigned long ioaddr;
148 unsigned short mdio_register;
149
150 struct ifec_tcb *tcbs;
159 /*
160 * The configured flag indicates if a Config command was last issued.
161 * The following attempt to issue a command (in ifec_tx_wake) will
162 * use a START rather than RESUME SCB command. It seems the card won't
163 * RESUME after a configure command.
164 */
168
169};
170
171/**************************** Function prototypes ****************************/
172
173/* PCI device API prototypes */
174static int ifec_pci_probe ( struct pci_device *pci );
175static void ifec_pci_remove ( struct pci_device *pci );
176
177/* Network device API prototypes */
178static void ifec_net_close ( struct net_device* );
179static void ifec_net_irq ( struct net_device*, int enable );
180static int ifec_net_open ( struct net_device* );
181static void ifec_net_poll ( struct net_device* );
182static int ifec_net_transmit ( struct net_device*, struct io_buffer *iobuf );
183
184/* Local function prototypes */
185static void ifec_init_eeprom ( struct net_device * );
186static int ifec_mdio_read ( struct net_device *, int phy, int location );
187static void ifec_mdio_setup ( struct net_device *, int options );
188static int ifec_mdio_write ( struct net_device *, int phy, int loc, int val);
189static void ifec_reset ( struct net_device * );
190static void ifec_free ( struct net_device * );
191static void ifec_rfd_init ( struct ifec_rfd *rfd, s16 command, u32 link );
192static void ifec_rx_process ( struct net_device * );
193static void ifec_reprime_ru ( struct net_device * );
194static void ifec_check_ru_status ( struct net_device *, unsigned short );
195static int ifec_get_rx_desc ( struct net_device *, int ,int ,int );
196static void ifec_refill_rx_ring ( struct net_device * );
197static int ifec_rx_setup ( struct net_device * );
198static int ifec_scb_cmd ( struct net_device *, u32 ptr, u8 cmd );
199static int ifec_scb_cmd_wait ( struct net_device * );
200static void ifec_tx_process ( struct net_device * );
201static int ifec_tx_setup ( struct net_device * );
202static void ifec_tx_wake ( struct net_device * );
203
204#endif
static int options
Definition 3c515.c:286
struct golan_eqe_cmd cmd
Definition CIB_PRM.h:1
u32 link
Link to next descriptor.
Definition ar9003_mac.h:1
static void ifec_reprime_ru(struct net_device *)
static int ifec_get_rx_desc(struct net_device *, int, int, int)
SCBCmdBits
Definition eepro100.h:37
@ 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
static void ifec_net_close(struct net_device *)
static int ifec_net_open(struct net_device *)
static void ifec_rx_process(struct net_device *)
static int ifec_rx_setup(struct net_device *)
static void ifec_free(struct net_device *)
static void ifec_tx_wake(struct net_device *)
Definition eepro100.c:1073
static void ifec_init_eeprom(struct net_device *)
static void ifec_net_poll(struct net_device *)
static void ifec_refill_rx_ring(struct net_device *)
static void ifec_net_irq(struct net_device *, int enable)
static void ifec_rfd_init(struct ifec_rfd *rfd, s16 command, u32 link)
static int ifec_tx_setup(struct net_device *)
static void ifec_tx_process(struct net_device *)
TCBBits
Definition eepro100.h:63
@ TCB_C
Definition eepro100.h:64
@ TCB_U
Definition eepro100.h:64
@ TCB_OK
Definition eepro100.h:64
RFDBits
Definition eepro100.h:67
@ 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
static int ifec_mdio_read(struct net_device *, int phy, int location)
static int ifec_pci_probe(struct pci_device *pci)
ActionCommands
Definition eepro100.h:54
@ 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
phy_chips
Definition eepro100.h:80
@ 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
static int ifec_mdio_write(struct net_device *, int phy, int loc, int val)
static int ifec_scb_cmd_wait(struct net_device *)
static void ifec_check_ru_status(struct net_device *, unsigned short)
#define TCB_COUNT
Definition eepro100.h:21
#define RFD_COUNT
Definition eepro100.h:20
static int ifec_net_transmit(struct net_device *, struct io_buffer *iobuf)
static void ifec_reset(struct net_device *)
static int ifec_scb_cmd(struct net_device *, u32 ptr, u8 cmd)
static void ifec_mdio_setup(struct net_device *, int options)
#define RFD_PACKET_LEN
Definition eepro100.h:15
static void ifec_pci_remove(struct pci_device *pci)
SCBPortCmds
Definition eepro100.h:49
@ PortReset
Definition eepro100.h:50
@ PortPartialReset
Definition eepro100.h:50
@ PortDump
Definition eepro100.h:50
@ PortSelfTest
Definition eepro100.h:50
CSROffsets
Definition eepro100.h:30
@ 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
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define u8
Definition igbvf_osdep.h:40
void __asmcall int val
Definition setjmp.h:12
int16_t s16
Definition stdint.h:21
int32_t s32
Definition stdint.h:23
A command-line command.
Definition command.h:10
u16 command
Definition eepro100.h:140
u32 link
Definition eepro100.h:141
volatile s16 status
Definition eepro100.h:139
u8 ia[6]
Definition eepro100.h:135
u16 command
Definition eepro100.h:133
volatile s16 status
Definition eepro100.h:132
u32 link
Definition eepro100.h:134
struct ifec_tcb * tcb_head
Definition eepro100.h:152
unsigned long ioaddr
Definition eepro100.h:146
struct spi_device eeprom
Definition eepro100.h:167
unsigned short mdio_register
Definition eepro100.h:148
struct spi_bit_basher spi
Definition eepro100.h:166
struct io_buffer * tx_iobs[TCB_COUNT]
Definition eepro100.h:153
struct ifec_stats stats
Definition eepro100.h:147
struct io_buffer * rx_iobs[RFD_COUNT]
Definition eepro100.h:154
struct ifec_tcb * tcb_tail
Definition eepro100.h:152
struct ifec_rfd * rfds[RFD_COUNT]
Definition eepro100.h:151
struct ifec_tcb * tcbs
Definition eepro100.h:150
char packet[RFD_PACKET_LEN]
Definition eepro100.h:128
u32 rx_buf_addr
Definition eepro100.h:125
s16 command
Definition eepro100.h:123
u32 link
Definition eepro100.h:124
volatile s16 status
Definition eepro100.h:122
u16 count
Definition eepro100.h:126
u16 size
Definition eepro100.h:127
u32 rx_good_frames
Definition eepro100.h:101
u32 tx_late_colls
Definition eepro100.h:98
u32 tx_deferred
Definition eepro100.h:99
u32 rx_resource_errs
Definition eepro100.h:102
u32 rx_align_errs
Definition eepro100.h:101
u32 rx_crc_errs
Definition eepro100.h:101
u32 tx_one_colls
Definition eepro100.h:100
u32 tx_total_colls
Definition eepro100.h:100
u32 tx_multi_colls
Definition eepro100.h:100
u32 rx_overrun_errs
Definition eepro100.h:102
u32 tx_good_frames
Definition eepro100.h:98
u32 rx_runt_errs
Definition eepro100.h:103
u32 tx_lost_carrier
Definition eepro100.h:99
u32 done_marker
Definition eepro100.h:103
u32 tx_underruns
Definition eepro100.h:99
u32 tx_coll16_errs
Definition eepro100.h:98
u32 rx_colls_errs
Definition eepro100.h:102
u32 tbda_addr
Definition eepro100.h:110
struct ifec_tcb * next
Definition eepro100.h:118
volatile s16 status
Definition eepro100.h:107
u32 link
Definition eepro100.h:109
struct io_buffer * iob
Definition eepro100.h:117
s32 count
Definition eepro100.h:111
s32 tbd_size0
Definition eepro100.h:115
u16 command
Definition eepro100.h:108
u32 tbd_addr0
Definition eepro100.h:114
A persistent I/O buffer.
Definition iobuf.h:38
A network device.
Definition netdevice.h:353
A PCI device.
Definition pci.h:211
A bit-bashing SPI bus.
Definition spi_bit.h:17
An SPI device.
Definition spi.h:87
#define u16
Definition vga.h:20
#define u32
Definition vga.h:21