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 
19 FILE_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  */
37 typedef enum {
38  EFAB_BOARD_INVALID = 0, /* Early boards do not have board rev. info. */
42  /* Insert new types before here */
45 
46 /* PHY types. */
47 typedef enum {
48  PHY_TYPE_AUTO = 0, /* on development board detect between CX4 & alaska */
55 } phy_type_t;
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 
84 struct efab_nic;
85 
86 /* A buffer table allocation backing a tx dma, rx dma or eventq */
89  int id;
90 };
91 
92 /* A TX queue */
93 struct efab_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 
155 struct efab_nic {
158  int is_asic;
159 
160  /* I2C bit-bashed interface */
162 
163  /** SPI bus and devices, and the user visible NVO area */
164  struct spi_bus spi_bus;
167  struct spi_device *spi;
168  struct nvo_block nvo;
169 
170  /** Board, MAC, and PHY operations tables */
174 
175  /* PHY and board types */
176  int phy_addr;
177  int phy_type;
178  int phy_10g;
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 */
198  int link_up;
199 
200  /** INT_REG_KER */
201  efab_oword_t int_ker __attribute__ (( aligned ( 16 ) ));
202 };
203 #endif /* EFAB_NIC_H */
204 
struct nvo_block nvo
#define __attribute__(x)
Definition: compiler.h:10
struct efab_special_buffer entry
struct efab_ev_queue ev_queue
uint8_t mac_addr[ETH_ALEN]
MAC address.
struct efab_special_buffer entry
A quadword (i.e.
Definition: etherfabric.h:111
unsigned int iobase
An SPI bus.
Definition: spi.h:126
struct efab_phy_operations * phy_op
struct net_device * netdev
efab_qword_t falcon_rx_desc_t
A bit-bashing I2C interface.
Definition: i2c.h:91
unsigned long dma_addr_t
Definition: bnx2.h:20
unsigned int write_ptr
unsigned int write_ptr
struct io_buffer * buf[EFAB_TXD_SIZE]
unsigned int read_ptr
efab_oword_t int_ker
INT_REG_KER.
struct efab_tx_queue tx_queue
struct spi_device spi_eeprom
int(* init)(struct efab_nic *efab)
falcon_rx_desc_t * ring
SPI interface.
phy_type_t
efab_board_type
Bit-bashing interfaces.
void * membase
Memory and IO base.
struct efab_mac_operations * mac_op
void(* fini)(struct efab_nic *efab)
Non-volatile stored options.
A block of non-volatile stored options.
Definition: nvo.h:22
unsigned int link_options
GMII link options.
A network device.
Definition: netdevice.h:352
int link_up
Link status.
falcon_tx_desc_t * ring
unsigned char uint8_t
Definition: stdint.h:10
#define ETH_ALEN
Definition: if_ether.h:8
struct spi_device spi_flash
struct spi_device * spi
An octword (eight-word, i.e.
Definition: etherfabric.h:122
#define EFAB_NUM_RX_DESC
struct efab_board_operations * board_op
Board, MAC, and PHY operations tables.
unsigned int read_ptr
FILE_LICENCE(GPL_ANY)
falcon_event_t * ring
efab_qword_t falcon_tx_desc_t
struct efab_special_buffer entry
An SPI device.
Definition: spi.h:86
unsigned int read_ptr
struct efab_rx_queue rx_queue
struct io_buffer * buf[EFAB_NUM_RX_DESC]
int(* init)(struct efab_nic *efab)
int(* init)(struct efab_nic *efab)
#define EFAB_TXD_SIZE
struct i2c_bit_basher i2c_bb
A persistent I/O buffer.
Definition: iobuf.h:33
efab_qword_t falcon_event_t
I2C interface.