xref: /linux/drivers/net/hippi/rrunner.h (revision 762f99f4f3cb41a775b5157dd761217beba65873)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2ff5a3b50SJeff Kirsher #ifndef _RRUNNER_H_
3ff5a3b50SJeff Kirsher #define _RRUNNER_H_
4ff5a3b50SJeff Kirsher 
5ff5a3b50SJeff Kirsher #include <linux/interrupt.h>
6ff5a3b50SJeff Kirsher 
7ff5a3b50SJeff Kirsher #if ((BITS_PER_LONG != 32) && (BITS_PER_LONG != 64))
8ff5a3b50SJeff Kirsher #error "BITS_PER_LONG not defined or not valid"
9ff5a3b50SJeff Kirsher #endif
10ff5a3b50SJeff Kirsher 
11ff5a3b50SJeff Kirsher 
12ff5a3b50SJeff Kirsher struct rr_regs {
13ff5a3b50SJeff Kirsher 
14ff5a3b50SJeff Kirsher 	u32	pad0[16];
15ff5a3b50SJeff Kirsher 
16ff5a3b50SJeff Kirsher 	u32	HostCtrl;
17ff5a3b50SJeff Kirsher 	u32	LocalCtrl;
18ff5a3b50SJeff Kirsher 	u32	Pc;
19ff5a3b50SJeff Kirsher 	u32	BrkPt;
20ff5a3b50SJeff Kirsher 
21ff5a3b50SJeff Kirsher /* Timer increments every 0.97 micro-seconds (unsigned int) */
22ff5a3b50SJeff Kirsher 	u32	Timer_Hi;
23ff5a3b50SJeff Kirsher 	u32	Timer;
24ff5a3b50SJeff Kirsher 	u32	TimerRef;
25ff5a3b50SJeff Kirsher 	u32	PciState;
26ff5a3b50SJeff Kirsher 
27ff5a3b50SJeff Kirsher 	u32	Event;
28ff5a3b50SJeff Kirsher 	u32	MbEvent;
29ff5a3b50SJeff Kirsher 
30ff5a3b50SJeff Kirsher 	u32	WinBase;
31ff5a3b50SJeff Kirsher 	u32	WinData;
32ff5a3b50SJeff Kirsher 	u32	RX_state;
33ff5a3b50SJeff Kirsher 	u32	TX_state;
34ff5a3b50SJeff Kirsher 
35ff5a3b50SJeff Kirsher 	u32	Overhead;
36ff5a3b50SJeff Kirsher 	u32	ExtIo;
37ff5a3b50SJeff Kirsher 
38ff5a3b50SJeff Kirsher 	u32	DmaWriteHostHi;
39ff5a3b50SJeff Kirsher 	u32	DmaWriteHostLo;
40ff5a3b50SJeff Kirsher 
41ff5a3b50SJeff Kirsher 	u32	pad1[2];
42ff5a3b50SJeff Kirsher 
43ff5a3b50SJeff Kirsher 	u32	DmaReadHostHi;
44ff5a3b50SJeff Kirsher 	u32	DmaReadHostLo;
45ff5a3b50SJeff Kirsher 
46ff5a3b50SJeff Kirsher 	u32	pad2;
47ff5a3b50SJeff Kirsher 
48ff5a3b50SJeff Kirsher 	u32	DmaReadLen;
49ff5a3b50SJeff Kirsher 	u32	DmaWriteState;
50ff5a3b50SJeff Kirsher 
51ff5a3b50SJeff Kirsher 	u32	DmaWriteLcl;
52ff5a3b50SJeff Kirsher 	u32	DmaWriteIPchecksum;
53ff5a3b50SJeff Kirsher 	u32	DmaWriteLen;
54ff5a3b50SJeff Kirsher 	u32	DmaReadState;
55ff5a3b50SJeff Kirsher 	u32	DmaReadLcl;
56ff5a3b50SJeff Kirsher 	u32	DmaReadIPchecksum;
57ff5a3b50SJeff Kirsher 	u32	pad3;
58ff5a3b50SJeff Kirsher 
59ff5a3b50SJeff Kirsher 	u32	RxBase;
60ff5a3b50SJeff Kirsher 	u32	RxPrd;
61ff5a3b50SJeff Kirsher 	u32	RxCon;
62ff5a3b50SJeff Kirsher 
63ff5a3b50SJeff Kirsher 	u32	pad4;
64ff5a3b50SJeff Kirsher 
65ff5a3b50SJeff Kirsher 	u32	TxBase;
66ff5a3b50SJeff Kirsher 	u32	TxPrd;
67ff5a3b50SJeff Kirsher 	u32	TxCon;
68ff5a3b50SJeff Kirsher 
69ff5a3b50SJeff Kirsher 	u32	pad5;
70ff5a3b50SJeff Kirsher 
71ff5a3b50SJeff Kirsher 	u32	RxIndPro;
72ff5a3b50SJeff Kirsher 	u32	RxIndCon;
73ff5a3b50SJeff Kirsher 	u32	RxIndRef;
74ff5a3b50SJeff Kirsher 
75ff5a3b50SJeff Kirsher 	u32	pad6;
76ff5a3b50SJeff Kirsher 
77ff5a3b50SJeff Kirsher 	u32	TxIndPro;
78ff5a3b50SJeff Kirsher 	u32	TxIndCon;
79ff5a3b50SJeff Kirsher 	u32	TxIndRef;
80ff5a3b50SJeff Kirsher 
81ff5a3b50SJeff Kirsher 	u32	pad7[17];
82ff5a3b50SJeff Kirsher 
83ff5a3b50SJeff Kirsher 	u32	DrCmndPro;
84ff5a3b50SJeff Kirsher 	u32	DrCmndCon;
85ff5a3b50SJeff Kirsher 	u32	DrCmndRef;
86ff5a3b50SJeff Kirsher 
87ff5a3b50SJeff Kirsher 	u32	pad8;
88ff5a3b50SJeff Kirsher 
89ff5a3b50SJeff Kirsher 	u32	DwCmndPro;
90ff5a3b50SJeff Kirsher 	u32	DwCmndCon;
91ff5a3b50SJeff Kirsher 	u32	DwCmndRef;
92ff5a3b50SJeff Kirsher 
93ff5a3b50SJeff Kirsher 	u32	AssistState;
94ff5a3b50SJeff Kirsher 
95ff5a3b50SJeff Kirsher 	u32	DrDataPro;
96ff5a3b50SJeff Kirsher 	u32	DrDataCon;
97ff5a3b50SJeff Kirsher 	u32	DrDataRef;
98ff5a3b50SJeff Kirsher 
99ff5a3b50SJeff Kirsher 	u32	pad9;
100ff5a3b50SJeff Kirsher 
101ff5a3b50SJeff Kirsher 	u32	DwDataPro;
102ff5a3b50SJeff Kirsher 	u32	DwDataCon;
103ff5a3b50SJeff Kirsher 	u32	DwDataRef;
104ff5a3b50SJeff Kirsher 
105ff5a3b50SJeff Kirsher 	u32	pad10[33];
106ff5a3b50SJeff Kirsher 
107ff5a3b50SJeff Kirsher 	u32	EvtCon;
108ff5a3b50SJeff Kirsher 
109ff5a3b50SJeff Kirsher 	u32	pad11[5];
110ff5a3b50SJeff Kirsher 
111ff5a3b50SJeff Kirsher 	u32	TxPi;
112ff5a3b50SJeff Kirsher 	u32	IpRxPi;
113ff5a3b50SJeff Kirsher 
114ff5a3b50SJeff Kirsher 	u32	pad11a[8];
115ff5a3b50SJeff Kirsher 
116ff5a3b50SJeff Kirsher 	u32	CmdRing[16];
117ff5a3b50SJeff Kirsher 
118ff5a3b50SJeff Kirsher /* The ULA is in two registers the high order two bytes of the first
119ff5a3b50SJeff Kirsher  * word contain the RunCode features.
120ff5a3b50SJeff Kirsher  * ula0		res	res	byte0	byte1
121ff5a3b50SJeff Kirsher  * ula1		byte2	byte3	byte4	byte5
122ff5a3b50SJeff Kirsher  */
123ff5a3b50SJeff Kirsher 	u32	Ula0;
124ff5a3b50SJeff Kirsher 	u32	Ula1;
125ff5a3b50SJeff Kirsher 
126ff5a3b50SJeff Kirsher 	u32	RxRingHi;
127ff5a3b50SJeff Kirsher 	u32	RxRingLo;
128ff5a3b50SJeff Kirsher 
129ff5a3b50SJeff Kirsher 	u32	InfoPtrHi;
130ff5a3b50SJeff Kirsher 	u32	InfoPtrLo;
131ff5a3b50SJeff Kirsher 
132ff5a3b50SJeff Kirsher 	u32	Mode;
133ff5a3b50SJeff Kirsher 
134ff5a3b50SJeff Kirsher 	u32	ConRetry;
135ff5a3b50SJeff Kirsher 	u32	ConRetryTmr;
136ff5a3b50SJeff Kirsher 
137ff5a3b50SJeff Kirsher 	u32	ConTmout;
138ff5a3b50SJeff Kirsher 	u32	CtatTmr;
139ff5a3b50SJeff Kirsher 
140ff5a3b50SJeff Kirsher 	u32	MaxRxRng;
141ff5a3b50SJeff Kirsher 
142ff5a3b50SJeff Kirsher 	u32	IntrTmr;
143ff5a3b50SJeff Kirsher 	u32	TxDataMvTimeout;
144ff5a3b50SJeff Kirsher 	u32	RxDataMvTimeout;
145ff5a3b50SJeff Kirsher 
146ff5a3b50SJeff Kirsher 	u32	EvtPrd;
147ff5a3b50SJeff Kirsher 	u32	TraceIdx;
148ff5a3b50SJeff Kirsher 
149ff5a3b50SJeff Kirsher 	u32	Fail1;
150ff5a3b50SJeff Kirsher 	u32	Fail2;
151ff5a3b50SJeff Kirsher 
152ff5a3b50SJeff Kirsher 	u32	DrvPrm;
153ff5a3b50SJeff Kirsher 
154ff5a3b50SJeff Kirsher 	u32	FilterLA;
155ff5a3b50SJeff Kirsher 
156ff5a3b50SJeff Kirsher 	u32	FwRev;
157ff5a3b50SJeff Kirsher 	u32	FwRes1;
158ff5a3b50SJeff Kirsher 	u32	FwRes2;
159ff5a3b50SJeff Kirsher 	u32	FwRes3;
160ff5a3b50SJeff Kirsher 
161ff5a3b50SJeff Kirsher 	u32	WriteDmaThresh;
162ff5a3b50SJeff Kirsher 	u32	ReadDmaThresh;
163ff5a3b50SJeff Kirsher 
164ff5a3b50SJeff Kirsher 	u32	pad12[325];
165ff5a3b50SJeff Kirsher 	u32	Window[512];
166ff5a3b50SJeff Kirsher };
167ff5a3b50SJeff Kirsher 
168ff5a3b50SJeff Kirsher /*
169ff5a3b50SJeff Kirsher  * Host control register bits.
170ff5a3b50SJeff Kirsher  */
171ff5a3b50SJeff Kirsher 
172ff5a3b50SJeff Kirsher #define RR_INT		0x01
173ff5a3b50SJeff Kirsher #define RR_CLEAR_INT	0x02
174ff5a3b50SJeff Kirsher #define NO_SWAP		0x04000004
175ff5a3b50SJeff Kirsher #define NO_SWAP1	0x00000004
176ff5a3b50SJeff Kirsher #define PCI_RESET_NIC	0x08
177ff5a3b50SJeff Kirsher #define HALT_NIC	0x10
178ff5a3b50SJeff Kirsher #define SSTEP_NIC	0x20
179ff5a3b50SJeff Kirsher #define MEM_READ_MULTI	0x40
180ff5a3b50SJeff Kirsher #define NIC_HALTED	0x100
181ff5a3b50SJeff Kirsher #define HALT_INST	0x200
182ff5a3b50SJeff Kirsher #define PARITY_ERR	0x400
183ff5a3b50SJeff Kirsher #define INVALID_INST_B	0x800
184ff5a3b50SJeff Kirsher #define RR_REV_2	0x20000000
185ff5a3b50SJeff Kirsher #define RR_REV_MASK	0xf0000000
186ff5a3b50SJeff Kirsher 
187ff5a3b50SJeff Kirsher /*
188ff5a3b50SJeff Kirsher  * Local control register bits.
189ff5a3b50SJeff Kirsher  */
190ff5a3b50SJeff Kirsher 
191ff5a3b50SJeff Kirsher #define INTA_STATE		0x01
192ff5a3b50SJeff Kirsher #define CLEAR_INTA		0x02
193ff5a3b50SJeff Kirsher #define FAST_EEPROM_ACCESS	0x08
194ff5a3b50SJeff Kirsher #define ENABLE_EXTRA_SRAM	0x100
195ff5a3b50SJeff Kirsher #define ENABLE_EXTRA_DESC	0x200
196ff5a3b50SJeff Kirsher #define ENABLE_PARITY		0x400
197ff5a3b50SJeff Kirsher #define FORCE_DMA_PARITY_ERROR	0x800
198ff5a3b50SJeff Kirsher #define ENABLE_EEPROM_WRITE	0x1000
199ff5a3b50SJeff Kirsher #define ENABLE_DATA_CACHE	0x2000
200ff5a3b50SJeff Kirsher #define SRAM_LO_PARITY_ERR	0x4000
201ff5a3b50SJeff Kirsher #define SRAM_HI_PARITY_ERR	0x8000
202ff5a3b50SJeff Kirsher 
203ff5a3b50SJeff Kirsher /*
204ff5a3b50SJeff Kirsher  * PCI state bits.
205ff5a3b50SJeff Kirsher  */
206ff5a3b50SJeff Kirsher 
207ff5a3b50SJeff Kirsher #define FORCE_PCI_RESET		0x01
208ff5a3b50SJeff Kirsher #define PROVIDE_LENGTH		0x02
209ff5a3b50SJeff Kirsher #define MASK_DMA_READ_MAX	0x1C
210ff5a3b50SJeff Kirsher #define RBURST_DISABLE		0x00
211ff5a3b50SJeff Kirsher #define RBURST_4		0x04
212ff5a3b50SJeff Kirsher #define RBURST_16		0x08
213ff5a3b50SJeff Kirsher #define RBURST_32		0x0C
214ff5a3b50SJeff Kirsher #define RBURST_64		0x10
215ff5a3b50SJeff Kirsher #define RBURST_128		0x14
216ff5a3b50SJeff Kirsher #define RBURST_256		0x18
217ff5a3b50SJeff Kirsher #define RBURST_1024		0x1C
218ff5a3b50SJeff Kirsher #define MASK_DMA_WRITE_MAX	0xE0
219ff5a3b50SJeff Kirsher #define WBURST_DISABLE		0x00
220ff5a3b50SJeff Kirsher #define WBURST_4		0x20
221ff5a3b50SJeff Kirsher #define WBURST_16		0x40
222ff5a3b50SJeff Kirsher #define WBURST_32		0x60
223ff5a3b50SJeff Kirsher #define WBURST_64		0x80
224ff5a3b50SJeff Kirsher #define WBURST_128		0xa0
225ff5a3b50SJeff Kirsher #define WBURST_256		0xc0
226ff5a3b50SJeff Kirsher #define WBURST_1024		0xe0
227ff5a3b50SJeff Kirsher #define MASK_MIN_DMA		0xFF00
228ff5a3b50SJeff Kirsher #define FIFO_RETRY_ENABLE	0x10000
229ff5a3b50SJeff Kirsher 
230ff5a3b50SJeff Kirsher /*
231ff5a3b50SJeff Kirsher  * Event register
232ff5a3b50SJeff Kirsher  */
233ff5a3b50SJeff Kirsher 
234ff5a3b50SJeff Kirsher #define DMA_WRITE_DONE		0x10000
235ff5a3b50SJeff Kirsher #define DMA_READ_DONE		0x20000
236ff5a3b50SJeff Kirsher #define DMA_WRITE_ERR		0x40000
237ff5a3b50SJeff Kirsher #define DMA_READ_ERR		0x80000
238ff5a3b50SJeff Kirsher 
239ff5a3b50SJeff Kirsher /*
240ff5a3b50SJeff Kirsher  * Receive state
241ff5a3b50SJeff Kirsher  *
242ff5a3b50SJeff Kirsher  * RoadRunner HIPPI Receive State Register controls and monitors the
243ff5a3b50SJeff Kirsher  * HIPPI receive interface in the NIC. Look at err bits when a HIPPI
244ff5a3b50SJeff Kirsher  * receive Error Event occurs.
245ff5a3b50SJeff Kirsher  */
246ff5a3b50SJeff Kirsher 
247ff5a3b50SJeff Kirsher #define ENABLE_NEW_CON		0x01
248ff5a3b50SJeff Kirsher #define RESET_RECV		0x02
249ff5a3b50SJeff Kirsher #define RECV_ALL		0x00
250ff5a3b50SJeff Kirsher #define RECV_1K			0x20
251ff5a3b50SJeff Kirsher #define RECV_2K			0x40
252ff5a3b50SJeff Kirsher #define RECV_4K			0x60
253ff5a3b50SJeff Kirsher #define RECV_8K			0x80
254ff5a3b50SJeff Kirsher #define RECV_16K		0xa0
255ff5a3b50SJeff Kirsher #define RECV_32K		0xc0
256ff5a3b50SJeff Kirsher #define RECV_64K		0xe0
257ff5a3b50SJeff Kirsher 
258ff5a3b50SJeff Kirsher /*
259ff5a3b50SJeff Kirsher  * Transmit status.
260ff5a3b50SJeff Kirsher  */
261ff5a3b50SJeff Kirsher 
262ff5a3b50SJeff Kirsher #define ENA_XMIT		0x01
263ff5a3b50SJeff Kirsher #define PERM_CON		0x02
264ff5a3b50SJeff Kirsher 
265ff5a3b50SJeff Kirsher /*
266ff5a3b50SJeff Kirsher  * DMA write state
267ff5a3b50SJeff Kirsher  */
268ff5a3b50SJeff Kirsher 
269ff5a3b50SJeff Kirsher #define RESET_DMA		0x01
270ff5a3b50SJeff Kirsher #define NO_SWAP_DMA		0x02
271ff5a3b50SJeff Kirsher #define DMA_ACTIVE		0x04
272ff5a3b50SJeff Kirsher #define THRESH_MASK		0x1F
273ff5a3b50SJeff Kirsher #define DMA_ERROR_MASK		0xff000000
274ff5a3b50SJeff Kirsher 
275ff5a3b50SJeff Kirsher /*
276ff5a3b50SJeff Kirsher  * Gooddies stored in the ULA registers.
277ff5a3b50SJeff Kirsher  */
278ff5a3b50SJeff Kirsher 
279ff5a3b50SJeff Kirsher #define TRACE_ON_WHAT_BIT	0x00020000    /* Traces on */
280ff5a3b50SJeff Kirsher #define ONEM_BUF_WHAT_BIT	0x00040000    /* 1Meg vs 256K */
281ff5a3b50SJeff Kirsher #define CHAR_API_WHAT_BIT	0x00080000    /* Char API vs network only */
282ff5a3b50SJeff Kirsher #define CMD_EVT_WHAT_BIT	0x00200000    /* Command event */
283ff5a3b50SJeff Kirsher #define LONG_TX_WHAT_BIT	0x00400000
284ff5a3b50SJeff Kirsher #define LONG_RX_WHAT_BIT	0x00800000
285ff5a3b50SJeff Kirsher #define WHAT_BIT_MASK		0xFFFD0000    /* Feature bit mask */
286ff5a3b50SJeff Kirsher 
287ff5a3b50SJeff Kirsher /*
288ff5a3b50SJeff Kirsher  * Mode status
289ff5a3b50SJeff Kirsher  */
290ff5a3b50SJeff Kirsher 
291ff5a3b50SJeff Kirsher #define EVENT_OVFL		0x80000000
292ff5a3b50SJeff Kirsher #define FATAL_ERR		0x40000000
293ff5a3b50SJeff Kirsher #define LOOP_BACK		0x01
294ff5a3b50SJeff Kirsher #define MODE_PH			0x02
295ff5a3b50SJeff Kirsher #define MODE_FP			0x00
296ff5a3b50SJeff Kirsher #define PTR64BIT		0x04
297ff5a3b50SJeff Kirsher #define PTR32BIT		0x00
298ff5a3b50SJeff Kirsher #define PTR_WD_SWAP		0x08
299ff5a3b50SJeff Kirsher #define PTR_WD_NOSWAP		0x00
300ff5a3b50SJeff Kirsher #define POST_WARN_EVENT		0x10
301ff5a3b50SJeff Kirsher #define ERR_TERM		0x20
302ff5a3b50SJeff Kirsher #define DIRECT_CONN		0x40
303ff5a3b50SJeff Kirsher #define NO_NIC_WATCHDOG		0x80
304ff5a3b50SJeff Kirsher #define SWAP_DATA		0x100
305ff5a3b50SJeff Kirsher #define SWAP_CONTROL		0x200
306ff5a3b50SJeff Kirsher #define NIC_HALT_ON_ERR		0x400
307ff5a3b50SJeff Kirsher #define NIC_NO_RESTART		0x800
308ff5a3b50SJeff Kirsher #define HALF_DUP_TX		0x1000
309ff5a3b50SJeff Kirsher #define HALF_DUP_RX		0x2000
310ff5a3b50SJeff Kirsher 
311ff5a3b50SJeff Kirsher 
312ff5a3b50SJeff Kirsher /*
313ff5a3b50SJeff Kirsher  * Error codes
314ff5a3b50SJeff Kirsher  */
315ff5a3b50SJeff Kirsher 
316ff5a3b50SJeff Kirsher /* Host Error Codes - values of fail1 */
317ff5a3b50SJeff Kirsher #define ERR_UNKNOWN_MBOX	0x1001
318ff5a3b50SJeff Kirsher #define ERR_UNKNOWN_CMD		0x1002
319ff5a3b50SJeff Kirsher #define ERR_MAX_RING		0x1003
320ff5a3b50SJeff Kirsher #define ERR_RING_CLOSED		0x1004
321ff5a3b50SJeff Kirsher #define ERR_RING_OPEN		0x1005
322ff5a3b50SJeff Kirsher /* Firmware internal errors */
323ff5a3b50SJeff Kirsher #define ERR_EVENT_RING_FULL	0x01
324ff5a3b50SJeff Kirsher #define ERR_DW_PEND_CMND_FULL	0x02
325ff5a3b50SJeff Kirsher #define ERR_DR_PEND_CMND_FULL	0x03
326ff5a3b50SJeff Kirsher #define ERR_DW_PEND_DATA_FULL	0x04
327ff5a3b50SJeff Kirsher #define ERR_DR_PEND_DATA_FULL	0x05
328ff5a3b50SJeff Kirsher #define ERR_ILLEGAL_JUMP	0x06
329ff5a3b50SJeff Kirsher #define ERR_UNIMPLEMENTED	0x07
330ff5a3b50SJeff Kirsher #define ERR_TX_INFO_FULL	0x08
331ff5a3b50SJeff Kirsher #define ERR_RX_INFO_FULL	0x09
332ff5a3b50SJeff Kirsher #define ERR_ILLEGAL_MODE	0x0A
333ff5a3b50SJeff Kirsher #define ERR_MAIN_TIMEOUT	0x0B
334ff5a3b50SJeff Kirsher #define ERR_EVENT_BITS		0x0C
335ff5a3b50SJeff Kirsher #define ERR_UNPEND_FULL		0x0D
336ff5a3b50SJeff Kirsher #define ERR_TIMER_QUEUE_FULL	0x0E
337ff5a3b50SJeff Kirsher #define ERR_TIMER_QUEUE_EMPTY	0x0F
338ff5a3b50SJeff Kirsher #define ERR_TIMER_NO_FREE	0x10
339ff5a3b50SJeff Kirsher #define ERR_INTR_START		0x11
340ff5a3b50SJeff Kirsher #define ERR_BAD_STARTUP		0x12
341ff5a3b50SJeff Kirsher #define ERR_NO_PKT_END		0x13
342ff5a3b50SJeff Kirsher #define ERR_HALTED_ON_ERR	0x14
343ff5a3b50SJeff Kirsher /* Hardware NIC Errors */
344ff5a3b50SJeff Kirsher #define ERR_WRITE_DMA		0x0101
345ff5a3b50SJeff Kirsher #define ERR_READ_DMA		0x0102
346ff5a3b50SJeff Kirsher #define ERR_EXT_SERIAL		0x0103
347ff5a3b50SJeff Kirsher #define ERR_TX_INT_PARITY	0x0104
348ff5a3b50SJeff Kirsher 
349ff5a3b50SJeff Kirsher 
350ff5a3b50SJeff Kirsher /*
351ff5a3b50SJeff Kirsher  * Event definitions
352ff5a3b50SJeff Kirsher  */
353ff5a3b50SJeff Kirsher 
354ff5a3b50SJeff Kirsher #define EVT_RING_ENTRIES	64
355ff5a3b50SJeff Kirsher #define EVT_RING_SIZE		(EVT_RING_ENTRIES * sizeof(struct event))
356ff5a3b50SJeff Kirsher 
357ff5a3b50SJeff Kirsher struct event {
358ff5a3b50SJeff Kirsher #ifdef __LITTLE_ENDIAN
359ff5a3b50SJeff Kirsher 	u16     index;
360ff5a3b50SJeff Kirsher 	u8      ring;
361ff5a3b50SJeff Kirsher 	u8      code;
362ff5a3b50SJeff Kirsher #else
363ff5a3b50SJeff Kirsher 	u8      code;
364ff5a3b50SJeff Kirsher 	u8      ring;
365ff5a3b50SJeff Kirsher 	u16     index;
366ff5a3b50SJeff Kirsher #endif
367ff5a3b50SJeff Kirsher 	u32     timestamp;
368ff5a3b50SJeff Kirsher };
369ff5a3b50SJeff Kirsher 
370ff5a3b50SJeff Kirsher /*
371ff5a3b50SJeff Kirsher  * General Events
372ff5a3b50SJeff Kirsher  */
373ff5a3b50SJeff Kirsher 
374ff5a3b50SJeff Kirsher #define E_NIC_UP	0x01
375ff5a3b50SJeff Kirsher #define E_WATCHDOG	0x02
376ff5a3b50SJeff Kirsher 
377ff5a3b50SJeff Kirsher #define E_STAT_UPD	0x04
378ff5a3b50SJeff Kirsher #define E_INVAL_CMD	0x05
379ff5a3b50SJeff Kirsher #define E_SET_CMD_CONS	0x06
380ff5a3b50SJeff Kirsher #define E_LINK_ON	0x07
381ff5a3b50SJeff Kirsher #define E_LINK_OFF	0x08
382ff5a3b50SJeff Kirsher #define E_INTERN_ERR	0x09
383ff5a3b50SJeff Kirsher #define E_HOST_ERR	0x0A
384ff5a3b50SJeff Kirsher #define E_STATS_UPDATE	0x0B
385ff5a3b50SJeff Kirsher #define E_REJECTING	0x0C
386ff5a3b50SJeff Kirsher 
387ff5a3b50SJeff Kirsher /*
388ff5a3b50SJeff Kirsher  * Send  Events
389ff5a3b50SJeff Kirsher  */
390ff5a3b50SJeff Kirsher #define E_CON_REJ	0x13
391ff5a3b50SJeff Kirsher #define E_CON_TMOUT	0x14
392ff5a3b50SJeff Kirsher #define E_CON_NC_TMOUT	0x15	/* I  , Connection No Campon Timeout */
393ff5a3b50SJeff Kirsher #define E_DISC_ERR	0x16
394ff5a3b50SJeff Kirsher #define E_INT_PRTY	0x17
395ff5a3b50SJeff Kirsher #define E_TX_IDLE	0x18
396ff5a3b50SJeff Kirsher #define E_TX_LINK_DROP	0x19
397ff5a3b50SJeff Kirsher #define E_TX_INV_RNG	0x1A
398ff5a3b50SJeff Kirsher #define E_TX_INV_BUF	0x1B
399ff5a3b50SJeff Kirsher #define E_TX_INV_DSC	0x1C
400ff5a3b50SJeff Kirsher 
401ff5a3b50SJeff Kirsher /*
402ff5a3b50SJeff Kirsher  * Destination Events
403ff5a3b50SJeff Kirsher  */
404ff5a3b50SJeff Kirsher /*
405ff5a3b50SJeff Kirsher  * General Receive events
406ff5a3b50SJeff Kirsher  */
407ff5a3b50SJeff Kirsher #define E_VAL_RNG	0x20
408ff5a3b50SJeff Kirsher #define E_RX_RNG_ENER	0x21
409ff5a3b50SJeff Kirsher #define E_INV_RNG	0x22
410ff5a3b50SJeff Kirsher #define E_RX_RNG_SPC	0x23
411ff5a3b50SJeff Kirsher #define E_RX_RNG_OUT	0x24
412ff5a3b50SJeff Kirsher #define E_PKT_DISCARD	0x25
413ff5a3b50SJeff Kirsher #define E_INFO_EVT	0x27
414ff5a3b50SJeff Kirsher 
415ff5a3b50SJeff Kirsher /*
416ff5a3b50SJeff Kirsher  * Data corrupted events
417ff5a3b50SJeff Kirsher  */
418ff5a3b50SJeff Kirsher #define E_RX_PAR_ERR	0x2B
419ff5a3b50SJeff Kirsher #define E_RX_LLRC_ERR	0x2C
420ff5a3b50SJeff Kirsher #define E_IP_CKSM_ERR	0x2D
421ff5a3b50SJeff Kirsher #define E_DTA_CKSM_ERR	0x2E
422ff5a3b50SJeff Kirsher #define E_SHT_BST	0x2F
423ff5a3b50SJeff Kirsher 
424ff5a3b50SJeff Kirsher /*
425ff5a3b50SJeff Kirsher  * Data lost events
426ff5a3b50SJeff Kirsher  */
427ff5a3b50SJeff Kirsher #define E_LST_LNK_ERR	0x30
428ff5a3b50SJeff Kirsher #define E_FLG_SYN_ERR	0x31
429ff5a3b50SJeff Kirsher #define E_FRM_ERR	0x32
430ff5a3b50SJeff Kirsher #define E_RX_IDLE	0x33
431ff5a3b50SJeff Kirsher #define E_PKT_LN_ERR	0x34
432ff5a3b50SJeff Kirsher #define E_STATE_ERR	0x35
433ff5a3b50SJeff Kirsher #define E_UNEXP_DATA	0x3C
434ff5a3b50SJeff Kirsher 
435ff5a3b50SJeff Kirsher /*
436ff5a3b50SJeff Kirsher  * Fatal events
437ff5a3b50SJeff Kirsher  */
438ff5a3b50SJeff Kirsher #define E_RX_INV_BUF	0x36
439ff5a3b50SJeff Kirsher #define E_RX_INV_DSC	0x37
440ff5a3b50SJeff Kirsher #define E_RNG_BLK	0x38
441ff5a3b50SJeff Kirsher 
442ff5a3b50SJeff Kirsher /*
443ff5a3b50SJeff Kirsher  * Warning events
444ff5a3b50SJeff Kirsher  */
445ff5a3b50SJeff Kirsher #define E_RX_TO		0x39
446ff5a3b50SJeff Kirsher #define E_BFR_SPC	0x3A
447ff5a3b50SJeff Kirsher #define E_INV_ULP	0x3B
448ff5a3b50SJeff Kirsher 
449ff5a3b50SJeff Kirsher #define E_NOT_IMPLEMENTED 0x40
450ff5a3b50SJeff Kirsher 
451ff5a3b50SJeff Kirsher 
452ff5a3b50SJeff Kirsher /*
453ff5a3b50SJeff Kirsher  * Commands
454ff5a3b50SJeff Kirsher  */
455ff5a3b50SJeff Kirsher 
456ff5a3b50SJeff Kirsher #define CMD_RING_ENTRIES	16
457ff5a3b50SJeff Kirsher 
458ff5a3b50SJeff Kirsher struct cmd {
459ff5a3b50SJeff Kirsher #ifdef __LITTLE_ENDIAN
460ff5a3b50SJeff Kirsher 	u16     index;
461ff5a3b50SJeff Kirsher 	u8      ring;
462ff5a3b50SJeff Kirsher 	u8      code;
463ff5a3b50SJeff Kirsher #else
464ff5a3b50SJeff Kirsher 	u8      code;
465ff5a3b50SJeff Kirsher 	u8      ring;
466ff5a3b50SJeff Kirsher 	u16     index;
467ff5a3b50SJeff Kirsher #endif
468ff5a3b50SJeff Kirsher };
469ff5a3b50SJeff Kirsher 
470ff5a3b50SJeff Kirsher #define C_START_FW	0x01
471ff5a3b50SJeff Kirsher #define C_UPD_STAT	0x02
472ff5a3b50SJeff Kirsher #define C_WATCHDOG	0x05
473ff5a3b50SJeff Kirsher #define C_DEL_RNG	0x09
474ff5a3b50SJeff Kirsher #define C_NEW_RNG	0x0A
475ff5a3b50SJeff Kirsher #define C_CONN		0x0D
476ff5a3b50SJeff Kirsher 
477ff5a3b50SJeff Kirsher 
478ff5a3b50SJeff Kirsher /*
479ff5a3b50SJeff Kirsher  * Mode bits
480ff5a3b50SJeff Kirsher  */
481ff5a3b50SJeff Kirsher 
482ff5a3b50SJeff Kirsher #define  PACKET_BAD		0x01 /* Packet had link-layer error */
483ff5a3b50SJeff Kirsher #define  INTERRUPT		0x02
484ff5a3b50SJeff Kirsher #define  TX_IP_CKSUM		0x04
485ff5a3b50SJeff Kirsher #define  PACKET_END		0x08
486ff5a3b50SJeff Kirsher #define  PACKET_START		0x10
487ff5a3b50SJeff Kirsher #define  SAME_IFIELD		0x80
488ff5a3b50SJeff Kirsher 
489ff5a3b50SJeff Kirsher 
490ff5a3b50SJeff Kirsher typedef struct {
491ff5a3b50SJeff Kirsher #if (BITS_PER_LONG == 64)
492ff5a3b50SJeff Kirsher 	u64 addrlo;
493ff5a3b50SJeff Kirsher #else
494ff5a3b50SJeff Kirsher 	u32 addrhi;
495ff5a3b50SJeff Kirsher 	u32 addrlo;
496ff5a3b50SJeff Kirsher #endif
497ff5a3b50SJeff Kirsher } rraddr;
498ff5a3b50SJeff Kirsher 
499ff5a3b50SJeff Kirsher 
set_rraddr(rraddr * ra,dma_addr_t addr)500ff5a3b50SJeff Kirsher static inline void set_rraddr(rraddr *ra, dma_addr_t addr)
501ff5a3b50SJeff Kirsher {
502ff5a3b50SJeff Kirsher 	unsigned long baddr = addr;
503ff5a3b50SJeff Kirsher #if (BITS_PER_LONG == 64)
504ff5a3b50SJeff Kirsher 	ra->addrlo = baddr;
505ff5a3b50SJeff Kirsher #else
506ff5a3b50SJeff Kirsher     /* Don't bother setting zero every time */
507ff5a3b50SJeff Kirsher 	ra->addrlo = baddr;
508ff5a3b50SJeff Kirsher #endif
509ff5a3b50SJeff Kirsher 	mb();
510ff5a3b50SJeff Kirsher }
511ff5a3b50SJeff Kirsher 
512ff5a3b50SJeff Kirsher 
set_rxaddr(struct rr_regs __iomem * regs,volatile dma_addr_t addr)513ff5a3b50SJeff Kirsher static inline void set_rxaddr(struct rr_regs __iomem *regs, volatile dma_addr_t addr)
514ff5a3b50SJeff Kirsher {
515ff5a3b50SJeff Kirsher 	unsigned long baddr = addr;
516ff5a3b50SJeff Kirsher #if (BITS_PER_LONG == 64) && defined(__LITTLE_ENDIAN)
517ff5a3b50SJeff Kirsher 	writel(baddr & 0xffffffff, &regs->RxRingHi);
518ff5a3b50SJeff Kirsher 	writel(baddr >> 32, &regs->RxRingLo);
519ff5a3b50SJeff Kirsher #elif (BITS_PER_LONG == 64)
520ff5a3b50SJeff Kirsher 	writel(baddr >> 32, &regs->RxRingHi);
521ff5a3b50SJeff Kirsher 	writel(baddr & 0xffffffff, &regs->RxRingLo);
522ff5a3b50SJeff Kirsher #else
523ff5a3b50SJeff Kirsher 	writel(0, &regs->RxRingHi);
524ff5a3b50SJeff Kirsher 	writel(baddr, &regs->RxRingLo);
525ff5a3b50SJeff Kirsher #endif
526ff5a3b50SJeff Kirsher 	mb();
527ff5a3b50SJeff Kirsher }
528ff5a3b50SJeff Kirsher 
529ff5a3b50SJeff Kirsher 
set_infoaddr(struct rr_regs __iomem * regs,volatile dma_addr_t addr)530ff5a3b50SJeff Kirsher static inline void set_infoaddr(struct rr_regs __iomem *regs, volatile dma_addr_t addr)
531ff5a3b50SJeff Kirsher {
532ff5a3b50SJeff Kirsher 	unsigned long baddr = addr;
533ff5a3b50SJeff Kirsher #if (BITS_PER_LONG == 64) && defined(__LITTLE_ENDIAN)
534ff5a3b50SJeff Kirsher 	writel(baddr & 0xffffffff, &regs->InfoPtrHi);
535ff5a3b50SJeff Kirsher 	writel(baddr >> 32, &regs->InfoPtrLo);
536ff5a3b50SJeff Kirsher #elif (BITS_PER_LONG == 64)
537ff5a3b50SJeff Kirsher 	writel(baddr >> 32, &regs->InfoPtrHi);
538ff5a3b50SJeff Kirsher 	writel(baddr & 0xffffffff, &regs->InfoPtrLo);
539ff5a3b50SJeff Kirsher #else
540ff5a3b50SJeff Kirsher 	writel(0, &regs->InfoPtrHi);
541ff5a3b50SJeff Kirsher 	writel(baddr, &regs->InfoPtrLo);
542ff5a3b50SJeff Kirsher #endif
543ff5a3b50SJeff Kirsher 	mb();
544ff5a3b50SJeff Kirsher }
545ff5a3b50SJeff Kirsher 
546ff5a3b50SJeff Kirsher 
547ff5a3b50SJeff Kirsher /*
548ff5a3b50SJeff Kirsher  * TX ring
549ff5a3b50SJeff Kirsher  */
550ff5a3b50SJeff Kirsher 
551ff5a3b50SJeff Kirsher #ifdef CONFIG_ROADRUNNER_LARGE_RINGS
552ff5a3b50SJeff Kirsher #define TX_RING_ENTRIES	32
553ff5a3b50SJeff Kirsher #else
554ff5a3b50SJeff Kirsher #define TX_RING_ENTRIES	16
555ff5a3b50SJeff Kirsher #endif
556ff5a3b50SJeff Kirsher #define TX_TOTAL_SIZE	(TX_RING_ENTRIES * sizeof(struct tx_desc))
557ff5a3b50SJeff Kirsher 
558ff5a3b50SJeff Kirsher struct tx_desc{
559ff5a3b50SJeff Kirsher 	rraddr	addr;
560ff5a3b50SJeff Kirsher 	u32	res;
561ff5a3b50SJeff Kirsher #ifdef __LITTLE_ENDIAN
562ff5a3b50SJeff Kirsher 	u16	size;
563ff5a3b50SJeff Kirsher 	u8	pad;
564ff5a3b50SJeff Kirsher 	u8	mode;
565ff5a3b50SJeff Kirsher #else
566ff5a3b50SJeff Kirsher 	u8	mode;
567ff5a3b50SJeff Kirsher 	u8	pad;
568ff5a3b50SJeff Kirsher 	u16	size;
569ff5a3b50SJeff Kirsher #endif
570ff5a3b50SJeff Kirsher };
571ff5a3b50SJeff Kirsher 
572ff5a3b50SJeff Kirsher 
573ff5a3b50SJeff Kirsher #ifdef CONFIG_ROADRUNNER_LARGE_RINGS
574ff5a3b50SJeff Kirsher #define RX_RING_ENTRIES	32
575ff5a3b50SJeff Kirsher #else
576ff5a3b50SJeff Kirsher #define RX_RING_ENTRIES 16
577ff5a3b50SJeff Kirsher #endif
578ff5a3b50SJeff Kirsher #define RX_TOTAL_SIZE	(RX_RING_ENTRIES * sizeof(struct rx_desc))
579ff5a3b50SJeff Kirsher 
580ff5a3b50SJeff Kirsher struct rx_desc{
581ff5a3b50SJeff Kirsher 	rraddr	addr;
582ff5a3b50SJeff Kirsher 	u32	res;
583ff5a3b50SJeff Kirsher #ifdef __LITTLE_ENDIAN
584ff5a3b50SJeff Kirsher 	u16	size;
585ff5a3b50SJeff Kirsher 	u8	pad;
586ff5a3b50SJeff Kirsher 	u8	mode;
587ff5a3b50SJeff Kirsher #else
588ff5a3b50SJeff Kirsher 	u8	mode;
589ff5a3b50SJeff Kirsher 	u8	pad;
590ff5a3b50SJeff Kirsher 	u16	size;
591ff5a3b50SJeff Kirsher #endif
592ff5a3b50SJeff Kirsher };
593ff5a3b50SJeff Kirsher 
594ff5a3b50SJeff Kirsher 
595ff5a3b50SJeff Kirsher /*
596ff5a3b50SJeff Kirsher  * ioctl's
597ff5a3b50SJeff Kirsher  */
598ff5a3b50SJeff Kirsher 
599ff5a3b50SJeff Kirsher #define SIOCRRPFW	SIOCDEVPRIVATE		/* put firmware */
600ff5a3b50SJeff Kirsher #define SIOCRRGFW	SIOCDEVPRIVATE+1	/* get firmware */
601ff5a3b50SJeff Kirsher #define SIOCRRID	SIOCDEVPRIVATE+2	/* identify */
602ff5a3b50SJeff Kirsher 
603ff5a3b50SJeff Kirsher 
604ff5a3b50SJeff Kirsher struct seg_hdr {
605ff5a3b50SJeff Kirsher 	u32	seg_start;
606ff5a3b50SJeff Kirsher 	u32	seg_len;
607ff5a3b50SJeff Kirsher 	u32	seg_eestart;
608ff5a3b50SJeff Kirsher };
609ff5a3b50SJeff Kirsher 
610ff5a3b50SJeff Kirsher 
611ff5a3b50SJeff Kirsher #define EEPROM_BASE 0x80000000
612ff5a3b50SJeff Kirsher #define EEPROM_WORDS 8192
613ff5a3b50SJeff Kirsher #define EEPROM_BYTES (EEPROM_WORDS * sizeof(u32))
614ff5a3b50SJeff Kirsher 
615ff5a3b50SJeff Kirsher struct eeprom_boot {
616ff5a3b50SJeff Kirsher 	u32	key1;
617ff5a3b50SJeff Kirsher 	u32	key2;
618ff5a3b50SJeff Kirsher 	u32	sram_size;
619ff5a3b50SJeff Kirsher 	struct	seg_hdr loader;
620ff5a3b50SJeff Kirsher 	u32	init_chksum;
621ff5a3b50SJeff Kirsher 	u32	reserved1;
622ff5a3b50SJeff Kirsher };
623ff5a3b50SJeff Kirsher 
624ff5a3b50SJeff Kirsher struct eeprom_manf {
625ff5a3b50SJeff Kirsher 	u32	HeaderFmt;
626ff5a3b50SJeff Kirsher 	u32	Firmware;
627ff5a3b50SJeff Kirsher 	u32	BoardRevision;
628ff5a3b50SJeff Kirsher 	u32	RoadrunnerRev;
629ff5a3b50SJeff Kirsher 	char	OpticsPart[8];
630ff5a3b50SJeff Kirsher 	u32	OpticsRev;
631ff5a3b50SJeff Kirsher 	u32	pad1;
632ff5a3b50SJeff Kirsher 	char	SramPart[8];
633ff5a3b50SJeff Kirsher 	u32	SramRev;
634ff5a3b50SJeff Kirsher 	u32	pad2;
635ff5a3b50SJeff Kirsher 	char	EepromPart[8];
636ff5a3b50SJeff Kirsher 	u32	EepromRev;
637ff5a3b50SJeff Kirsher 	u32	EepromSize;
638ff5a3b50SJeff Kirsher 	char	PalPart[8];
639ff5a3b50SJeff Kirsher 	u32	PalRev;
640ff5a3b50SJeff Kirsher 	u32	pad3;
641ff5a3b50SJeff Kirsher 	char	PalCodeFile[12];
642ff5a3b50SJeff Kirsher 	u32	PalCodeRev;
643ff5a3b50SJeff Kirsher 	char	BoardULA[8];
644ff5a3b50SJeff Kirsher 	char	SerialNo[8];
645ff5a3b50SJeff Kirsher 	char	MfgDate[8];
646ff5a3b50SJeff Kirsher 	char	MfgTime[8];
647ff5a3b50SJeff Kirsher 	char	ModifyDate[8];
648ff5a3b50SJeff Kirsher 	u32	ModCount;
649ff5a3b50SJeff Kirsher 	u32	pad4[13];
650ff5a3b50SJeff Kirsher };
651ff5a3b50SJeff Kirsher 
652ff5a3b50SJeff Kirsher 
653ff5a3b50SJeff Kirsher struct eeprom_phase_info {
654ff5a3b50SJeff Kirsher 	char	phase1File[12];
655ff5a3b50SJeff Kirsher 	u32	phase1Rev;
656ff5a3b50SJeff Kirsher 	char	phase1Date[8];
657ff5a3b50SJeff Kirsher 	char	phase2File[12];
658ff5a3b50SJeff Kirsher 	u32	phase2Rev;
659ff5a3b50SJeff Kirsher 	char	phase2Date[8];
660ff5a3b50SJeff Kirsher 	u32	reserved7[4];
661ff5a3b50SJeff Kirsher };
662ff5a3b50SJeff Kirsher 
663ff5a3b50SJeff Kirsher struct eeprom_rncd_info {
664ff5a3b50SJeff Kirsher 	u32	FwStart;
665ff5a3b50SJeff Kirsher 	u32	FwRev;
666ff5a3b50SJeff Kirsher 	char	FwDate[8];
667ff5a3b50SJeff Kirsher 	u32	AddrRunCodeSegs;
668ff5a3b50SJeff Kirsher 	u32	FileNames;
669ff5a3b50SJeff Kirsher 	char	File[13][8];
670ff5a3b50SJeff Kirsher };
671ff5a3b50SJeff Kirsher 
672ff5a3b50SJeff Kirsher 
673ff5a3b50SJeff Kirsher /* Phase 1 region (starts are word offset 0x80) */
674ff5a3b50SJeff Kirsher struct phase1_hdr{
675ff5a3b50SJeff Kirsher 	u32	jump;
676ff5a3b50SJeff Kirsher 	u32	noop;
677ff5a3b50SJeff Kirsher 	struct seg_hdr phase2Seg;
678ff5a3b50SJeff Kirsher };
679ff5a3b50SJeff Kirsher 
680ff5a3b50SJeff Kirsher struct eeprom {
681ff5a3b50SJeff Kirsher 	struct eeprom_boot	boot;
682ff5a3b50SJeff Kirsher 	u32			pad1[8];
683ff5a3b50SJeff Kirsher 	struct eeprom_manf	manf;
684ff5a3b50SJeff Kirsher 	struct eeprom_phase_info phase_info;
685ff5a3b50SJeff Kirsher 	struct eeprom_rncd_info	rncd_info;
686ff5a3b50SJeff Kirsher 	u32			pad2[15];
687ff5a3b50SJeff Kirsher 	u32			hdr_checksum;
688ff5a3b50SJeff Kirsher 	struct phase1_hdr	phase1;
689ff5a3b50SJeff Kirsher };
690ff5a3b50SJeff Kirsher 
691ff5a3b50SJeff Kirsher 
692ff5a3b50SJeff Kirsher struct rr_stats {
693ff5a3b50SJeff Kirsher 	u32	NicTimeStamp;
694ff5a3b50SJeff Kirsher 	u32	RngCreated;
695ff5a3b50SJeff Kirsher 	u32	RngDeleted;
696ff5a3b50SJeff Kirsher 	u32	IntrGen;
697ff5a3b50SJeff Kirsher 	u32	NEvtOvfl;
698ff5a3b50SJeff Kirsher 	u32	InvCmd;
699ff5a3b50SJeff Kirsher 	u32	DmaReadErrs;
700ff5a3b50SJeff Kirsher 	u32	DmaWriteErrs;
701ff5a3b50SJeff Kirsher 	u32	StatUpdtT;
702ff5a3b50SJeff Kirsher 	u32	StatUpdtC;
703ff5a3b50SJeff Kirsher 	u32	WatchDog;
704ff5a3b50SJeff Kirsher 	u32	Trace;
705ff5a3b50SJeff Kirsher 
706ff5a3b50SJeff Kirsher 	/* Serial HIPPI */
707ff5a3b50SJeff Kirsher 	u32	LnkRdyEst;
708ff5a3b50SJeff Kirsher 	u32	GLinkErr;
709ff5a3b50SJeff Kirsher 	u32	AltFlgErr;
710ff5a3b50SJeff Kirsher 	u32	OvhdBit8Sync;
711ff5a3b50SJeff Kirsher 	u32	RmtSerPrtyErr;
712ff5a3b50SJeff Kirsher 	u32	RmtParPrtyErr;
713ff5a3b50SJeff Kirsher 	u32	RmtLoopBk;
714ff5a3b50SJeff Kirsher 	u32	pad1;
715ff5a3b50SJeff Kirsher 
716ff5a3b50SJeff Kirsher 	/* HIPPI tx */
717ff5a3b50SJeff Kirsher 	u32	ConEst;
718ff5a3b50SJeff Kirsher 	u32	ConRejS;
719ff5a3b50SJeff Kirsher 	u32	ConRetry;
720ff5a3b50SJeff Kirsher 	u32	ConTmOut;
721ff5a3b50SJeff Kirsher 	u32	SndConDiscon;
722ff5a3b50SJeff Kirsher 	u32	SndParErr;
723ff5a3b50SJeff Kirsher 	u32	PktSnt;
724ff5a3b50SJeff Kirsher 	u32	pad2[2];
725ff5a3b50SJeff Kirsher 	u32	ShFBstSnt;
726ff5a3b50SJeff Kirsher 	u64	BytSent;
727ff5a3b50SJeff Kirsher 	u32	TxTimeout;
728ff5a3b50SJeff Kirsher 	u32	pad3[3];
729ff5a3b50SJeff Kirsher 
730ff5a3b50SJeff Kirsher 	/* HIPPI rx */
731ff5a3b50SJeff Kirsher 	u32	ConAcc;
732ff5a3b50SJeff Kirsher 	u32	ConRejdiPrty;
733ff5a3b50SJeff Kirsher 	u32	ConRejd64b;
734ff5a3b50SJeff Kirsher 	u32	ConRejdBuf;
735ff5a3b50SJeff Kirsher 	u32	RxConDiscon;
736ff5a3b50SJeff Kirsher 	u32	RxConNoData;
737ff5a3b50SJeff Kirsher 	u32	PktRx;
738ff5a3b50SJeff Kirsher 	u32	pad4[2];
739ff5a3b50SJeff Kirsher 	u32	ShFBstRx;
740ff5a3b50SJeff Kirsher 	u64	BytRx;
741ff5a3b50SJeff Kirsher 	u32	RxParErr;
742ff5a3b50SJeff Kirsher 	u32	RxLLRCerr;
743ff5a3b50SJeff Kirsher 	u32	RxBstSZerr;
744ff5a3b50SJeff Kirsher 	u32	RxStateErr;
745ff5a3b50SJeff Kirsher 	u32	RxRdyErr;
746ff5a3b50SJeff Kirsher 	u32	RxInvULP;
747ff5a3b50SJeff Kirsher 	u32	RxSpcBuf;
748ff5a3b50SJeff Kirsher 	u32	RxSpcDesc;
749ff5a3b50SJeff Kirsher 	u32	RxRngSpc;
750ff5a3b50SJeff Kirsher 	u32	RxRngFull;
751ff5a3b50SJeff Kirsher 	u32	RxPktLenErr;
752ff5a3b50SJeff Kirsher 	u32	RxCksmErr;
753ff5a3b50SJeff Kirsher 	u32	RxPktDrp;
754ff5a3b50SJeff Kirsher 	u32	RngLowSpc;
755ff5a3b50SJeff Kirsher 	u32	RngDataClose;
756ff5a3b50SJeff Kirsher 	u32	RxTimeout;
757ff5a3b50SJeff Kirsher 	u32	RxIdle;
758ff5a3b50SJeff Kirsher };
759ff5a3b50SJeff Kirsher 
760ff5a3b50SJeff Kirsher 
761ff5a3b50SJeff Kirsher /*
762ff5a3b50SJeff Kirsher  * This struct is shared with the NIC firmware.
763ff5a3b50SJeff Kirsher  */
764ff5a3b50SJeff Kirsher struct ring_ctrl {
765ff5a3b50SJeff Kirsher 	rraddr	rngptr;
766ff5a3b50SJeff Kirsher #ifdef __LITTLE_ENDIAN
767ff5a3b50SJeff Kirsher 	u16	entries;
768ff5a3b50SJeff Kirsher 	u8	pad;
769ff5a3b50SJeff Kirsher 	u8	entry_size;
770ff5a3b50SJeff Kirsher 	u16	pi;
771ff5a3b50SJeff Kirsher 	u16	mode;
772ff5a3b50SJeff Kirsher #else
773ff5a3b50SJeff Kirsher 	u8	entry_size;
774ff5a3b50SJeff Kirsher 	u8	pad;
775ff5a3b50SJeff Kirsher 	u16	entries;
776ff5a3b50SJeff Kirsher 	u16	mode;
777ff5a3b50SJeff Kirsher 	u16	pi;
778ff5a3b50SJeff Kirsher #endif
779ff5a3b50SJeff Kirsher };
780ff5a3b50SJeff Kirsher 
781ff5a3b50SJeff Kirsher struct rr_info {
782ff5a3b50SJeff Kirsher 	union {
783ff5a3b50SJeff Kirsher 		struct rr_stats stats;
784ff5a3b50SJeff Kirsher 		u32 stati[128];
785ff5a3b50SJeff Kirsher 	} s;
786ff5a3b50SJeff Kirsher 	struct ring_ctrl	evt_ctrl;
787ff5a3b50SJeff Kirsher 	struct ring_ctrl	cmd_ctrl;
788ff5a3b50SJeff Kirsher 	struct ring_ctrl	tx_ctrl;
789ff5a3b50SJeff Kirsher 	u8			pad[464];
790ff5a3b50SJeff Kirsher 	u8			trace[3072];
791ff5a3b50SJeff Kirsher };
792ff5a3b50SJeff Kirsher 
793ff5a3b50SJeff Kirsher /*
794ff5a3b50SJeff Kirsher  * The linux structure for the RoadRunner.
795ff5a3b50SJeff Kirsher  *
796ff5a3b50SJeff Kirsher  * RX/TX descriptors are put first to make sure they are properly
797ff5a3b50SJeff Kirsher  * aligned and do not cross cache-line boundaries.
798ff5a3b50SJeff Kirsher  */
799ff5a3b50SJeff Kirsher 
800ff5a3b50SJeff Kirsher struct rr_private
801ff5a3b50SJeff Kirsher {
802ff5a3b50SJeff Kirsher 	struct rx_desc		*rx_ring;
803ff5a3b50SJeff Kirsher 	struct tx_desc		*tx_ring;
804ff5a3b50SJeff Kirsher 	struct event		*evt_ring;
805ff5a3b50SJeff Kirsher 	dma_addr_t 		tx_ring_dma;
806ff5a3b50SJeff Kirsher 	dma_addr_t 		rx_ring_dma;
807ff5a3b50SJeff Kirsher 	dma_addr_t 		evt_ring_dma;
808ff5a3b50SJeff Kirsher 	/* Alignment ok ? */
809ff5a3b50SJeff Kirsher 	struct sk_buff		*rx_skbuff[RX_RING_ENTRIES];
810ff5a3b50SJeff Kirsher 	struct sk_buff		*tx_skbuff[TX_RING_ENTRIES];
811ff5a3b50SJeff Kirsher 	struct rr_regs		__iomem *regs;		/* Register base */
812ff5a3b50SJeff Kirsher 	struct ring_ctrl	*rx_ctrl;	/* Receive ring control */
813ff5a3b50SJeff Kirsher 	struct rr_info		*info;		/* Shared info page */
814ff5a3b50SJeff Kirsher 	dma_addr_t 		rx_ctrl_dma;
815ff5a3b50SJeff Kirsher 	dma_addr_t 		info_dma;
816ff5a3b50SJeff Kirsher 	spinlock_t		lock;
817ff5a3b50SJeff Kirsher 	struct timer_list	timer;
818ff5a3b50SJeff Kirsher 	u32			cur_rx, cur_cmd, cur_evt;
819ff5a3b50SJeff Kirsher 	u32			dirty_rx, dirty_tx;
820ff5a3b50SJeff Kirsher 	u32			tx_full;
821ff5a3b50SJeff Kirsher 	u32			fw_rev;
822ff5a3b50SJeff Kirsher 	volatile short		fw_running;
823ff5a3b50SJeff Kirsher 	struct pci_dev		*pci_dev;
824ff5a3b50SJeff Kirsher };
825ff5a3b50SJeff Kirsher 
826ff5a3b50SJeff Kirsher 
827ff5a3b50SJeff Kirsher /*
828ff5a3b50SJeff Kirsher  * Prototypes
829ff5a3b50SJeff Kirsher  */
830ff5a3b50SJeff Kirsher static int rr_init(struct net_device *dev);
831ff5a3b50SJeff Kirsher static int rr_init1(struct net_device *dev);
832ff5a3b50SJeff Kirsher static irqreturn_t rr_interrupt(int irq, void *dev_id);
833ff5a3b50SJeff Kirsher 
834ff5a3b50SJeff Kirsher static int rr_open(struct net_device *dev);
835ff5a3b50SJeff Kirsher static netdev_tx_t rr_start_xmit(struct sk_buff *skb,
836ff5a3b50SJeff Kirsher 				 struct net_device *dev);
837ff5a3b50SJeff Kirsher static int rr_close(struct net_device *dev);
838*81a68110SArnd Bergmann static int rr_siocdevprivate(struct net_device *dev, struct ifreq *rq,
839*81a68110SArnd Bergmann 			     void __user *data, int cmd);
840ff5a3b50SJeff Kirsher static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
841ff5a3b50SJeff Kirsher 				   unsigned long offset,
842ff5a3b50SJeff Kirsher 				   unsigned char *buf,
843ff5a3b50SJeff Kirsher 				   unsigned long length);
844ff5a3b50SJeff Kirsher static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset);
845ff5a3b50SJeff Kirsher static int rr_load_firmware(struct net_device *dev);
846ff5a3b50SJeff Kirsher static inline void rr_raz_tx(struct rr_private *, struct net_device *);
847ff5a3b50SJeff Kirsher static inline void rr_raz_rx(struct rr_private *, struct net_device *);
848ff5a3b50SJeff Kirsher #endif /* _RRUNNER_H_ */
849