iPXE
etherfabric_nic.h
Go to the documentation of this file.
1/**************************************************************************
2 *
3 * Etherboot driver for Level 5 Etherfabric network cards
4 *
5 * Written by Michael Brown <mbrown@fensystems.co.uk>
6 *
7 * Copyright Fen Systems Ltd. 2005
8 * Copyright Level 5 Networks Inc. 2005
9 *
10 * This software may be used and distributed according to the terms of
11 * the GNU General Public License (GPL), incorporated herein by
12 * reference. Drivers based on or derived from this code fall under
13 * the GPL and must retain the authorship, copyright and license
14 * notice.
15 *
16 **************************************************************************
17 */
18
19FILE_LICENCE ( GPL_ANY );
20
21#ifndef EFAB_NIC_H
22#define EFAB_NIC_H
23#include <ipxe/bitbash.h>
24#include <ipxe/i2c.h>
25#include <ipxe/spi.h>
26#include <ipxe/nvo.h>
27#include <ipxe/if_ether.h>
28/**************************************************************************
29 *
30 * Constants and macros
31 *
32 **************************************************************************
33 */
34/* Board IDs. Early boards have no board_type, (e.g. EF1002 and 401/403)
35 * But newer boards are getting bigger...
36 */
37typedef enum {
38 EFAB_BOARD_INVALID = 0, /* Early boards do not have board rev. info. */
42 /* Insert new types before here */
45
46/* PHY types. */
47typedef enum {
48 PHY_TYPE_AUTO = 0, /* on development board detect between CX4 & alaska */
56
57/**************************************************************************
58 *
59 * Hardware data structures and sizing
60 *
61 **************************************************************************
62 */
63
64#define dma_addr_t unsigned long
68
69#define EFAB_BUF_ALIGN 4096
70#define EFAB_RXD_SIZE 512
71#define EFAB_TXD_SIZE 512
72#define EFAB_EVQ_SIZE 512
73
74#define EFAB_NUM_RX_DESC 16
75#define EFAB_RX_BUF_SIZE 1600
76
77/**************************************************************************
78 *
79 * Data structures
80 *
81 **************************************************************************
82 */
83
84struct efab_nic;
85
86/* A buffer table allocation backing a tx dma, rx dma or eventq */
91
92/* A TX queue */
94 /* The hardware ring */
96
97 /* The software ring storing io_buffers. */
99
100 /* The buffer table reservation pushed to hardware */
102
103 /* Software descriptor write ptr */
104 unsigned int write_ptr;
105
106 /* Hardware descriptor read ptr */
107 unsigned int read_ptr;
108};
109
110/* An RX queue */
112 /* The hardware ring */
114
115 /* The software ring storing io_buffers */
117
118 /* The buffer table reservation pushed to hardware */
120
121 /* Descriptor write ptr, into both the hardware and software rings */
122 unsigned int write_ptr;
123
124 /* Hardware completion ptr */
125 unsigned int read_ptr;
126};
127
128/* An event queue */
130 /* The hardware ring to push to hardware.
131 * Must be the first entry in the structure */
133
134 /* The buffer table reservation pushed to hardware */
136
137 /* Pointers into the ring */
138 unsigned int read_ptr;
139};
140
142 int ( * init ) ( struct efab_nic *efab );
143};
144
146 int ( * init ) ( struct efab_nic *efab );
147 unsigned int mmds;
148};
149
151 int ( * init ) ( struct efab_nic *efab );
152 void ( * fini ) ( struct efab_nic *efab );
153};
154
155struct efab_nic {
159
160 /* I2C bit-bashed interface */
162
163 /** SPI bus and devices, and the user visible NVO area */
169
170 /** Board, MAC, and PHY operations tables */
174
175 /* PHY and board types */
180
181 /** Memory and IO base */
182 void *membase;
183 unsigned int iobase;
184
185 /* Buffer table allocation head */
187
188 /* Queues */
192
193 /** MAC address */
195 /** GMII link options */
196 unsigned int link_options;
197 /** Link status */
199
200 /** INT_REG_KER */
201 efab_oword_t int_ker __attribute__ (( aligned ( 16 ) ));
202};
203#endif /* EFAB_NIC_H */
204
unsigned char uint8_t
Definition stdint.h:10
Bit-bashing interfaces.
union efab_qword efab_qword_t
A quadword (i.e.
union efab_oword efab_oword_t
An octword (eight-word, i.e.
#define EFAB_NUM_RX_DESC
#define EFAB_TXD_SIZE
phy_type_t
@ PHY_TYPE_CX4_RTMR
@ PHY_TYPE_CX4
@ PHY_TYPE_AUTO
@ PHY_TYPE_XFP
@ PHY_TYPE_PM8358
@ PHY_TYPE_10XPRESS
@ PHY_TYPE_1GIG_ALASKA
efab_qword_t falcon_tx_desc_t
efab_board_type
@ EFAB_BOARD_SFE4001
@ EFAB_BOARD_INVALID
@ EFAB_BOARD_MAX
@ EFAB_BOARD_SFE4003
@ EFAB_BOARD_SFE4002
efab_qword_t falcon_rx_desc_t
#define dma_addr_t
efab_qword_t falcon_event_t
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
I2C interface.
#define ETH_ALEN
Definition if_ether.h:9
#define __attribute__(x)
Definition compiler.h:10
Non-volatile stored options.
SPI interface.
void(* fini)(struct efab_nic *efab)
int(* init)(struct efab_nic *efab)
unsigned int read_ptr
struct efab_special_buffer entry
falcon_event_t * ring
int(* init)(struct efab_nic *efab)
struct efab_ev_queue ev_queue
void * membase
Memory and IO base.
struct nvo_block nvo
struct spi_device * spi
struct net_device * netdev
efab_oword_t int_ker
INT_REG_KER.
struct efab_rx_queue rx_queue
struct efab_board_operations * board_op
Board, MAC, and PHY operations tables.
struct i2c_bit_basher i2c_bb
int link_up
Link status.
struct spi_device spi_eeprom
struct efab_tx_queue tx_queue
struct efab_mac_operations * mac_op
struct efab_phy_operations * phy_op
unsigned int link_options
GMII link options.
struct spi_device spi_flash
struct spi_bus spi_bus
SPI bus and devices, and the user visible NVO area.
uint8_t mac_addr[ETH_ALEN]
MAC address.
unsigned int iobase
int(* init)(struct efab_nic *efab)
unsigned int read_ptr
struct io_buffer * buf[EFAB_NUM_RX_DESC]
falcon_rx_desc_t * ring
unsigned int write_ptr
struct efab_special_buffer entry
unsigned int read_ptr
falcon_tx_desc_t * ring
unsigned int write_ptr
struct efab_special_buffer entry
struct io_buffer * buf[EFAB_TXD_SIZE]
A bit-bashing I2C interface.
Definition i2c.h:91
A persistent I/O buffer.
Definition iobuf.h:38
A network device.
Definition netdevice.h:353
A block of non-volatile stored options.
Definition nvo.h:23
An SPI device.
Definition spi.h:87