18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _RRUNNER_H_
38c2ecf20Sopenharmony_ci#define _RRUNNER_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#if ((BITS_PER_LONG != 32) && (BITS_PER_LONG != 64))
88c2ecf20Sopenharmony_ci#error "BITS_PER_LONG not defined or not valid"
98c2ecf20Sopenharmony_ci#endif
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cistruct rr_regs {
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci	u32	pad0[16];
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci	u32	HostCtrl;
178c2ecf20Sopenharmony_ci	u32	LocalCtrl;
188c2ecf20Sopenharmony_ci	u32	Pc;
198c2ecf20Sopenharmony_ci	u32	BrkPt;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Timer increments every 0.97 micro-seconds (unsigned int) */
228c2ecf20Sopenharmony_ci	u32	Timer_Hi;
238c2ecf20Sopenharmony_ci	u32	Timer;
248c2ecf20Sopenharmony_ci	u32	TimerRef;
258c2ecf20Sopenharmony_ci	u32	PciState;
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	u32	Event;
288c2ecf20Sopenharmony_ci	u32	MbEvent;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	u32	WinBase;
318c2ecf20Sopenharmony_ci	u32	WinData;
328c2ecf20Sopenharmony_ci	u32	RX_state;
338c2ecf20Sopenharmony_ci	u32	TX_state;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	u32	Overhead;
368c2ecf20Sopenharmony_ci	u32	ExtIo;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci	u32	DmaWriteHostHi;
398c2ecf20Sopenharmony_ci	u32	DmaWriteHostLo;
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	u32	pad1[2];
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	u32	DmaReadHostHi;
448c2ecf20Sopenharmony_ci	u32	DmaReadHostLo;
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci	u32	pad2;
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	u32	DmaReadLen;
498c2ecf20Sopenharmony_ci	u32	DmaWriteState;
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	u32	DmaWriteLcl;
528c2ecf20Sopenharmony_ci	u32	DmaWriteIPchecksum;
538c2ecf20Sopenharmony_ci	u32	DmaWriteLen;
548c2ecf20Sopenharmony_ci	u32	DmaReadState;
558c2ecf20Sopenharmony_ci	u32	DmaReadLcl;
568c2ecf20Sopenharmony_ci	u32	DmaReadIPchecksum;
578c2ecf20Sopenharmony_ci	u32	pad3;
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	u32	RxBase;
608c2ecf20Sopenharmony_ci	u32	RxPrd;
618c2ecf20Sopenharmony_ci	u32	RxCon;
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	u32	pad4;
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci	u32	TxBase;
668c2ecf20Sopenharmony_ci	u32	TxPrd;
678c2ecf20Sopenharmony_ci	u32	TxCon;
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci	u32	pad5;
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci	u32	RxIndPro;
728c2ecf20Sopenharmony_ci	u32	RxIndCon;
738c2ecf20Sopenharmony_ci	u32	RxIndRef;
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	u32	pad6;
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci	u32	TxIndPro;
788c2ecf20Sopenharmony_ci	u32	TxIndCon;
798c2ecf20Sopenharmony_ci	u32	TxIndRef;
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci	u32	pad7[17];
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci	u32	DrCmndPro;
848c2ecf20Sopenharmony_ci	u32	DrCmndCon;
858c2ecf20Sopenharmony_ci	u32	DrCmndRef;
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci	u32	pad8;
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci	u32	DwCmndPro;
908c2ecf20Sopenharmony_ci	u32	DwCmndCon;
918c2ecf20Sopenharmony_ci	u32	DwCmndRef;
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci	u32	AssistState;
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci	u32	DrDataPro;
968c2ecf20Sopenharmony_ci	u32	DrDataCon;
978c2ecf20Sopenharmony_ci	u32	DrDataRef;
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci	u32	pad9;
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci	u32	DwDataPro;
1028c2ecf20Sopenharmony_ci	u32	DwDataCon;
1038c2ecf20Sopenharmony_ci	u32	DwDataRef;
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	u32	pad10[33];
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci	u32	EvtCon;
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci	u32	pad11[5];
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci	u32	TxPi;
1128c2ecf20Sopenharmony_ci	u32	IpRxPi;
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci	u32	pad11a[8];
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci	u32	CmdRing[16];
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci/* The ULA is in two registers the high order two bytes of the first
1198c2ecf20Sopenharmony_ci * word contain the RunCode features.
1208c2ecf20Sopenharmony_ci * ula0		res	res	byte0	byte1
1218c2ecf20Sopenharmony_ci * ula1		byte2	byte3	byte4	byte5
1228c2ecf20Sopenharmony_ci */
1238c2ecf20Sopenharmony_ci	u32	Ula0;
1248c2ecf20Sopenharmony_ci	u32	Ula1;
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	u32	RxRingHi;
1278c2ecf20Sopenharmony_ci	u32	RxRingLo;
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci	u32	InfoPtrHi;
1308c2ecf20Sopenharmony_ci	u32	InfoPtrLo;
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci	u32	Mode;
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci	u32	ConRetry;
1358c2ecf20Sopenharmony_ci	u32	ConRetryTmr;
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci	u32	ConTmout;
1388c2ecf20Sopenharmony_ci	u32	CtatTmr;
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci	u32	MaxRxRng;
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci	u32	IntrTmr;
1438c2ecf20Sopenharmony_ci	u32	TxDataMvTimeout;
1448c2ecf20Sopenharmony_ci	u32	RxDataMvTimeout;
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci	u32	EvtPrd;
1478c2ecf20Sopenharmony_ci	u32	TraceIdx;
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci	u32	Fail1;
1508c2ecf20Sopenharmony_ci	u32	Fail2;
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci	u32	DrvPrm;
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci	u32	FilterLA;
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci	u32	FwRev;
1578c2ecf20Sopenharmony_ci	u32	FwRes1;
1588c2ecf20Sopenharmony_ci	u32	FwRes2;
1598c2ecf20Sopenharmony_ci	u32	FwRes3;
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci	u32	WriteDmaThresh;
1628c2ecf20Sopenharmony_ci	u32	ReadDmaThresh;
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci	u32	pad12[325];
1658c2ecf20Sopenharmony_ci	u32	Window[512];
1668c2ecf20Sopenharmony_ci};
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci/*
1698c2ecf20Sopenharmony_ci * Host control register bits.
1708c2ecf20Sopenharmony_ci */
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci#define RR_INT		0x01
1738c2ecf20Sopenharmony_ci#define RR_CLEAR_INT	0x02
1748c2ecf20Sopenharmony_ci#define NO_SWAP		0x04000004
1758c2ecf20Sopenharmony_ci#define NO_SWAP1	0x00000004
1768c2ecf20Sopenharmony_ci#define PCI_RESET_NIC	0x08
1778c2ecf20Sopenharmony_ci#define HALT_NIC	0x10
1788c2ecf20Sopenharmony_ci#define SSTEP_NIC	0x20
1798c2ecf20Sopenharmony_ci#define MEM_READ_MULTI	0x40
1808c2ecf20Sopenharmony_ci#define NIC_HALTED	0x100
1818c2ecf20Sopenharmony_ci#define HALT_INST	0x200
1828c2ecf20Sopenharmony_ci#define PARITY_ERR	0x400
1838c2ecf20Sopenharmony_ci#define INVALID_INST_B	0x800
1848c2ecf20Sopenharmony_ci#define RR_REV_2	0x20000000
1858c2ecf20Sopenharmony_ci#define RR_REV_MASK	0xf0000000
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci/*
1888c2ecf20Sopenharmony_ci * Local control register bits.
1898c2ecf20Sopenharmony_ci */
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci#define INTA_STATE		0x01
1928c2ecf20Sopenharmony_ci#define CLEAR_INTA		0x02
1938c2ecf20Sopenharmony_ci#define FAST_EEPROM_ACCESS	0x08
1948c2ecf20Sopenharmony_ci#define ENABLE_EXTRA_SRAM	0x100
1958c2ecf20Sopenharmony_ci#define ENABLE_EXTRA_DESC	0x200
1968c2ecf20Sopenharmony_ci#define ENABLE_PARITY		0x400
1978c2ecf20Sopenharmony_ci#define FORCE_DMA_PARITY_ERROR	0x800
1988c2ecf20Sopenharmony_ci#define ENABLE_EEPROM_WRITE	0x1000
1998c2ecf20Sopenharmony_ci#define ENABLE_DATA_CACHE	0x2000
2008c2ecf20Sopenharmony_ci#define SRAM_LO_PARITY_ERR	0x4000
2018c2ecf20Sopenharmony_ci#define SRAM_HI_PARITY_ERR	0x8000
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/*
2048c2ecf20Sopenharmony_ci * PCI state bits.
2058c2ecf20Sopenharmony_ci */
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci#define FORCE_PCI_RESET		0x01
2088c2ecf20Sopenharmony_ci#define PROVIDE_LENGTH		0x02
2098c2ecf20Sopenharmony_ci#define MASK_DMA_READ_MAX	0x1C
2108c2ecf20Sopenharmony_ci#define RBURST_DISABLE		0x00
2118c2ecf20Sopenharmony_ci#define RBURST_4		0x04
2128c2ecf20Sopenharmony_ci#define RBURST_16		0x08
2138c2ecf20Sopenharmony_ci#define RBURST_32		0x0C
2148c2ecf20Sopenharmony_ci#define RBURST_64		0x10
2158c2ecf20Sopenharmony_ci#define RBURST_128		0x14
2168c2ecf20Sopenharmony_ci#define RBURST_256		0x18
2178c2ecf20Sopenharmony_ci#define RBURST_1024		0x1C
2188c2ecf20Sopenharmony_ci#define MASK_DMA_WRITE_MAX	0xE0
2198c2ecf20Sopenharmony_ci#define WBURST_DISABLE		0x00
2208c2ecf20Sopenharmony_ci#define WBURST_4		0x20
2218c2ecf20Sopenharmony_ci#define WBURST_16		0x40
2228c2ecf20Sopenharmony_ci#define WBURST_32		0x60
2238c2ecf20Sopenharmony_ci#define WBURST_64		0x80
2248c2ecf20Sopenharmony_ci#define WBURST_128		0xa0
2258c2ecf20Sopenharmony_ci#define WBURST_256		0xc0
2268c2ecf20Sopenharmony_ci#define WBURST_1024		0xe0
2278c2ecf20Sopenharmony_ci#define MASK_MIN_DMA		0xFF00
2288c2ecf20Sopenharmony_ci#define FIFO_RETRY_ENABLE	0x10000
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci/*
2318c2ecf20Sopenharmony_ci * Event register
2328c2ecf20Sopenharmony_ci */
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci#define DMA_WRITE_DONE		0x10000
2358c2ecf20Sopenharmony_ci#define DMA_READ_DONE		0x20000
2368c2ecf20Sopenharmony_ci#define DMA_WRITE_ERR		0x40000
2378c2ecf20Sopenharmony_ci#define DMA_READ_ERR		0x80000
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci/*
2408c2ecf20Sopenharmony_ci * Receive state
2418c2ecf20Sopenharmony_ci *
2428c2ecf20Sopenharmony_ci * RoadRunner HIPPI Receive State Register controls and monitors the
2438c2ecf20Sopenharmony_ci * HIPPI receive interface in the NIC. Look at err bits when a HIPPI
2448c2ecf20Sopenharmony_ci * receive Error Event occurs.
2458c2ecf20Sopenharmony_ci */
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci#define ENABLE_NEW_CON		0x01
2488c2ecf20Sopenharmony_ci#define RESET_RECV		0x02
2498c2ecf20Sopenharmony_ci#define RECV_ALL		0x00
2508c2ecf20Sopenharmony_ci#define RECV_1K			0x20
2518c2ecf20Sopenharmony_ci#define RECV_2K			0x40
2528c2ecf20Sopenharmony_ci#define RECV_4K			0x60
2538c2ecf20Sopenharmony_ci#define RECV_8K			0x80
2548c2ecf20Sopenharmony_ci#define RECV_16K		0xa0
2558c2ecf20Sopenharmony_ci#define RECV_32K		0xc0
2568c2ecf20Sopenharmony_ci#define RECV_64K		0xe0
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci/*
2598c2ecf20Sopenharmony_ci * Transmit status.
2608c2ecf20Sopenharmony_ci */
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci#define ENA_XMIT		0x01
2638c2ecf20Sopenharmony_ci#define PERM_CON		0x02
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci/*
2668c2ecf20Sopenharmony_ci * DMA write state
2678c2ecf20Sopenharmony_ci */
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci#define RESET_DMA		0x01
2708c2ecf20Sopenharmony_ci#define NO_SWAP_DMA		0x02
2718c2ecf20Sopenharmony_ci#define DMA_ACTIVE		0x04
2728c2ecf20Sopenharmony_ci#define THRESH_MASK		0x1F
2738c2ecf20Sopenharmony_ci#define DMA_ERROR_MASK		0xff000000
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci/*
2768c2ecf20Sopenharmony_ci * Gooddies stored in the ULA registers.
2778c2ecf20Sopenharmony_ci */
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci#define TRACE_ON_WHAT_BIT	0x00020000    /* Traces on */
2808c2ecf20Sopenharmony_ci#define ONEM_BUF_WHAT_BIT	0x00040000    /* 1Meg vs 256K */
2818c2ecf20Sopenharmony_ci#define CHAR_API_WHAT_BIT	0x00080000    /* Char API vs network only */
2828c2ecf20Sopenharmony_ci#define CMD_EVT_WHAT_BIT	0x00200000    /* Command event */
2838c2ecf20Sopenharmony_ci#define LONG_TX_WHAT_BIT	0x00400000
2848c2ecf20Sopenharmony_ci#define LONG_RX_WHAT_BIT	0x00800000
2858c2ecf20Sopenharmony_ci#define WHAT_BIT_MASK		0xFFFD0000    /* Feature bit mask */
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci/*
2888c2ecf20Sopenharmony_ci * Mode status
2898c2ecf20Sopenharmony_ci */
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci#define EVENT_OVFL		0x80000000
2928c2ecf20Sopenharmony_ci#define FATAL_ERR		0x40000000
2938c2ecf20Sopenharmony_ci#define LOOP_BACK		0x01
2948c2ecf20Sopenharmony_ci#define MODE_PH			0x02
2958c2ecf20Sopenharmony_ci#define MODE_FP			0x00
2968c2ecf20Sopenharmony_ci#define PTR64BIT		0x04
2978c2ecf20Sopenharmony_ci#define PTR32BIT		0x00
2988c2ecf20Sopenharmony_ci#define PTR_WD_SWAP		0x08
2998c2ecf20Sopenharmony_ci#define PTR_WD_NOSWAP		0x00
3008c2ecf20Sopenharmony_ci#define POST_WARN_EVENT		0x10
3018c2ecf20Sopenharmony_ci#define ERR_TERM		0x20
3028c2ecf20Sopenharmony_ci#define DIRECT_CONN		0x40
3038c2ecf20Sopenharmony_ci#define NO_NIC_WATCHDOG		0x80
3048c2ecf20Sopenharmony_ci#define SWAP_DATA		0x100
3058c2ecf20Sopenharmony_ci#define SWAP_CONTROL		0x200
3068c2ecf20Sopenharmony_ci#define NIC_HALT_ON_ERR		0x400
3078c2ecf20Sopenharmony_ci#define NIC_NO_RESTART		0x800
3088c2ecf20Sopenharmony_ci#define HALF_DUP_TX		0x1000
3098c2ecf20Sopenharmony_ci#define HALF_DUP_RX		0x2000
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci/*
3138c2ecf20Sopenharmony_ci * Error codes
3148c2ecf20Sopenharmony_ci */
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci/* Host Error Codes - values of fail1 */
3178c2ecf20Sopenharmony_ci#define ERR_UNKNOWN_MBOX	0x1001
3188c2ecf20Sopenharmony_ci#define ERR_UNKNOWN_CMD		0x1002
3198c2ecf20Sopenharmony_ci#define ERR_MAX_RING		0x1003
3208c2ecf20Sopenharmony_ci#define ERR_RING_CLOSED		0x1004
3218c2ecf20Sopenharmony_ci#define ERR_RING_OPEN		0x1005
3228c2ecf20Sopenharmony_ci/* Firmware internal errors */
3238c2ecf20Sopenharmony_ci#define ERR_EVENT_RING_FULL	0x01
3248c2ecf20Sopenharmony_ci#define ERR_DW_PEND_CMND_FULL	0x02
3258c2ecf20Sopenharmony_ci#define ERR_DR_PEND_CMND_FULL	0x03
3268c2ecf20Sopenharmony_ci#define ERR_DW_PEND_DATA_FULL	0x04
3278c2ecf20Sopenharmony_ci#define ERR_DR_PEND_DATA_FULL	0x05
3288c2ecf20Sopenharmony_ci#define ERR_ILLEGAL_JUMP	0x06
3298c2ecf20Sopenharmony_ci#define ERR_UNIMPLEMENTED	0x07
3308c2ecf20Sopenharmony_ci#define ERR_TX_INFO_FULL	0x08
3318c2ecf20Sopenharmony_ci#define ERR_RX_INFO_FULL	0x09
3328c2ecf20Sopenharmony_ci#define ERR_ILLEGAL_MODE	0x0A
3338c2ecf20Sopenharmony_ci#define ERR_MAIN_TIMEOUT	0x0B
3348c2ecf20Sopenharmony_ci#define ERR_EVENT_BITS		0x0C
3358c2ecf20Sopenharmony_ci#define ERR_UNPEND_FULL		0x0D
3368c2ecf20Sopenharmony_ci#define ERR_TIMER_QUEUE_FULL	0x0E
3378c2ecf20Sopenharmony_ci#define ERR_TIMER_QUEUE_EMPTY	0x0F
3388c2ecf20Sopenharmony_ci#define ERR_TIMER_NO_FREE	0x10
3398c2ecf20Sopenharmony_ci#define ERR_INTR_START		0x11
3408c2ecf20Sopenharmony_ci#define ERR_BAD_STARTUP		0x12
3418c2ecf20Sopenharmony_ci#define ERR_NO_PKT_END		0x13
3428c2ecf20Sopenharmony_ci#define ERR_HALTED_ON_ERR	0x14
3438c2ecf20Sopenharmony_ci/* Hardware NIC Errors */
3448c2ecf20Sopenharmony_ci#define ERR_WRITE_DMA		0x0101
3458c2ecf20Sopenharmony_ci#define ERR_READ_DMA		0x0102
3468c2ecf20Sopenharmony_ci#define ERR_EXT_SERIAL		0x0103
3478c2ecf20Sopenharmony_ci#define ERR_TX_INT_PARITY	0x0104
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci/*
3518c2ecf20Sopenharmony_ci * Event definitions
3528c2ecf20Sopenharmony_ci */
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci#define EVT_RING_ENTRIES	64
3558c2ecf20Sopenharmony_ci#define EVT_RING_SIZE		(EVT_RING_ENTRIES * sizeof(struct event))
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_cistruct event {
3588c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
3598c2ecf20Sopenharmony_ci	u16     index;
3608c2ecf20Sopenharmony_ci	u8      ring;
3618c2ecf20Sopenharmony_ci	u8      code;
3628c2ecf20Sopenharmony_ci#else
3638c2ecf20Sopenharmony_ci	u8      code;
3648c2ecf20Sopenharmony_ci	u8      ring;
3658c2ecf20Sopenharmony_ci	u16     index;
3668c2ecf20Sopenharmony_ci#endif
3678c2ecf20Sopenharmony_ci	u32     timestamp;
3688c2ecf20Sopenharmony_ci};
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci/*
3718c2ecf20Sopenharmony_ci * General Events
3728c2ecf20Sopenharmony_ci */
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_ci#define E_NIC_UP	0x01
3758c2ecf20Sopenharmony_ci#define E_WATCHDOG	0x02
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci#define E_STAT_UPD	0x04
3788c2ecf20Sopenharmony_ci#define E_INVAL_CMD	0x05
3798c2ecf20Sopenharmony_ci#define E_SET_CMD_CONS	0x06
3808c2ecf20Sopenharmony_ci#define E_LINK_ON	0x07
3818c2ecf20Sopenharmony_ci#define E_LINK_OFF	0x08
3828c2ecf20Sopenharmony_ci#define E_INTERN_ERR	0x09
3838c2ecf20Sopenharmony_ci#define E_HOST_ERR	0x0A
3848c2ecf20Sopenharmony_ci#define E_STATS_UPDATE	0x0B
3858c2ecf20Sopenharmony_ci#define E_REJECTING	0x0C
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci/*
3888c2ecf20Sopenharmony_ci * Send  Events
3898c2ecf20Sopenharmony_ci */
3908c2ecf20Sopenharmony_ci#define E_CON_REJ	0x13
3918c2ecf20Sopenharmony_ci#define E_CON_TMOUT	0x14
3928c2ecf20Sopenharmony_ci#define E_CON_NC_TMOUT	0x15	/* I  , Connection No Campon Timeout */
3938c2ecf20Sopenharmony_ci#define E_DISC_ERR	0x16
3948c2ecf20Sopenharmony_ci#define E_INT_PRTY	0x17
3958c2ecf20Sopenharmony_ci#define E_TX_IDLE	0x18
3968c2ecf20Sopenharmony_ci#define E_TX_LINK_DROP	0x19
3978c2ecf20Sopenharmony_ci#define E_TX_INV_RNG	0x1A
3988c2ecf20Sopenharmony_ci#define E_TX_INV_BUF	0x1B
3998c2ecf20Sopenharmony_ci#define E_TX_INV_DSC	0x1C
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci/*
4028c2ecf20Sopenharmony_ci * Destination Events
4038c2ecf20Sopenharmony_ci */
4048c2ecf20Sopenharmony_ci/*
4058c2ecf20Sopenharmony_ci * General Receive events
4068c2ecf20Sopenharmony_ci */
4078c2ecf20Sopenharmony_ci#define E_VAL_RNG	0x20
4088c2ecf20Sopenharmony_ci#define E_RX_RNG_ENER	0x21
4098c2ecf20Sopenharmony_ci#define E_INV_RNG	0x22
4108c2ecf20Sopenharmony_ci#define E_RX_RNG_SPC	0x23
4118c2ecf20Sopenharmony_ci#define E_RX_RNG_OUT	0x24
4128c2ecf20Sopenharmony_ci#define E_PKT_DISCARD	0x25
4138c2ecf20Sopenharmony_ci#define E_INFO_EVT	0x27
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_ci/*
4168c2ecf20Sopenharmony_ci * Data corrupted events
4178c2ecf20Sopenharmony_ci */
4188c2ecf20Sopenharmony_ci#define E_RX_PAR_ERR	0x2B
4198c2ecf20Sopenharmony_ci#define E_RX_LLRC_ERR	0x2C
4208c2ecf20Sopenharmony_ci#define E_IP_CKSM_ERR	0x2D
4218c2ecf20Sopenharmony_ci#define E_DTA_CKSM_ERR	0x2E
4228c2ecf20Sopenharmony_ci#define E_SHT_BST	0x2F
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci/*
4258c2ecf20Sopenharmony_ci * Data lost events
4268c2ecf20Sopenharmony_ci */
4278c2ecf20Sopenharmony_ci#define E_LST_LNK_ERR	0x30
4288c2ecf20Sopenharmony_ci#define E_FLG_SYN_ERR	0x31
4298c2ecf20Sopenharmony_ci#define E_FRM_ERR	0x32
4308c2ecf20Sopenharmony_ci#define E_RX_IDLE	0x33
4318c2ecf20Sopenharmony_ci#define E_PKT_LN_ERR	0x34
4328c2ecf20Sopenharmony_ci#define E_STATE_ERR	0x35
4338c2ecf20Sopenharmony_ci#define E_UNEXP_DATA	0x3C
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci/*
4368c2ecf20Sopenharmony_ci * Fatal events
4378c2ecf20Sopenharmony_ci */
4388c2ecf20Sopenharmony_ci#define E_RX_INV_BUF	0x36
4398c2ecf20Sopenharmony_ci#define E_RX_INV_DSC	0x37
4408c2ecf20Sopenharmony_ci#define E_RNG_BLK	0x38
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_ci/*
4438c2ecf20Sopenharmony_ci * Warning events
4448c2ecf20Sopenharmony_ci */
4458c2ecf20Sopenharmony_ci#define E_RX_TO		0x39
4468c2ecf20Sopenharmony_ci#define E_BFR_SPC	0x3A
4478c2ecf20Sopenharmony_ci#define E_INV_ULP	0x3B
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_ci#define E_NOT_IMPLEMENTED 0x40
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci/*
4538c2ecf20Sopenharmony_ci * Commands
4548c2ecf20Sopenharmony_ci */
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ci#define CMD_RING_ENTRIES	16
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_cistruct cmd {
4598c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
4608c2ecf20Sopenharmony_ci	u16     index;
4618c2ecf20Sopenharmony_ci	u8      ring;
4628c2ecf20Sopenharmony_ci	u8      code;
4638c2ecf20Sopenharmony_ci#else
4648c2ecf20Sopenharmony_ci	u8      code;
4658c2ecf20Sopenharmony_ci	u8      ring;
4668c2ecf20Sopenharmony_ci	u16     index;
4678c2ecf20Sopenharmony_ci#endif
4688c2ecf20Sopenharmony_ci};
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci#define C_START_FW	0x01
4718c2ecf20Sopenharmony_ci#define C_UPD_STAT	0x02
4728c2ecf20Sopenharmony_ci#define C_WATCHDOG	0x05
4738c2ecf20Sopenharmony_ci#define C_DEL_RNG	0x09
4748c2ecf20Sopenharmony_ci#define C_NEW_RNG	0x0A
4758c2ecf20Sopenharmony_ci#define C_CONN		0x0D
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ci
4788c2ecf20Sopenharmony_ci/*
4798c2ecf20Sopenharmony_ci * Mode bits
4808c2ecf20Sopenharmony_ci */
4818c2ecf20Sopenharmony_ci
4828c2ecf20Sopenharmony_ci#define  PACKET_BAD		0x01 /* Packet had link-layer error */
4838c2ecf20Sopenharmony_ci#define  INTERRUPT		0x02
4848c2ecf20Sopenharmony_ci#define  TX_IP_CKSUM		0x04
4858c2ecf20Sopenharmony_ci#define  PACKET_END		0x08
4868c2ecf20Sopenharmony_ci#define  PACKET_START		0x10
4878c2ecf20Sopenharmony_ci#define  SAME_IFIELD		0x80
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_citypedef struct {
4918c2ecf20Sopenharmony_ci#if (BITS_PER_LONG == 64)
4928c2ecf20Sopenharmony_ci	u64 addrlo;
4938c2ecf20Sopenharmony_ci#else
4948c2ecf20Sopenharmony_ci	u32 addrhi;
4958c2ecf20Sopenharmony_ci	u32 addrlo;
4968c2ecf20Sopenharmony_ci#endif
4978c2ecf20Sopenharmony_ci} rraddr;
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci
5008c2ecf20Sopenharmony_cistatic inline void set_rraddr(rraddr *ra, dma_addr_t addr)
5018c2ecf20Sopenharmony_ci{
5028c2ecf20Sopenharmony_ci	unsigned long baddr = addr;
5038c2ecf20Sopenharmony_ci#if (BITS_PER_LONG == 64)
5048c2ecf20Sopenharmony_ci	ra->addrlo = baddr;
5058c2ecf20Sopenharmony_ci#else
5068c2ecf20Sopenharmony_ci    /* Don't bother setting zero every time */
5078c2ecf20Sopenharmony_ci	ra->addrlo = baddr;
5088c2ecf20Sopenharmony_ci#endif
5098c2ecf20Sopenharmony_ci	mb();
5108c2ecf20Sopenharmony_ci}
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_cistatic inline void set_rxaddr(struct rr_regs __iomem *regs, volatile dma_addr_t addr)
5148c2ecf20Sopenharmony_ci{
5158c2ecf20Sopenharmony_ci	unsigned long baddr = addr;
5168c2ecf20Sopenharmony_ci#if (BITS_PER_LONG == 64) && defined(__LITTLE_ENDIAN)
5178c2ecf20Sopenharmony_ci	writel(baddr & 0xffffffff, &regs->RxRingHi);
5188c2ecf20Sopenharmony_ci	writel(baddr >> 32, &regs->RxRingLo);
5198c2ecf20Sopenharmony_ci#elif (BITS_PER_LONG == 64)
5208c2ecf20Sopenharmony_ci	writel(baddr >> 32, &regs->RxRingHi);
5218c2ecf20Sopenharmony_ci	writel(baddr & 0xffffffff, &regs->RxRingLo);
5228c2ecf20Sopenharmony_ci#else
5238c2ecf20Sopenharmony_ci	writel(0, &regs->RxRingHi);
5248c2ecf20Sopenharmony_ci	writel(baddr, &regs->RxRingLo);
5258c2ecf20Sopenharmony_ci#endif
5268c2ecf20Sopenharmony_ci	mb();
5278c2ecf20Sopenharmony_ci}
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_cistatic inline void set_infoaddr(struct rr_regs __iomem *regs, volatile dma_addr_t addr)
5318c2ecf20Sopenharmony_ci{
5328c2ecf20Sopenharmony_ci	unsigned long baddr = addr;
5338c2ecf20Sopenharmony_ci#if (BITS_PER_LONG == 64) && defined(__LITTLE_ENDIAN)
5348c2ecf20Sopenharmony_ci	writel(baddr & 0xffffffff, &regs->InfoPtrHi);
5358c2ecf20Sopenharmony_ci	writel(baddr >> 32, &regs->InfoPtrLo);
5368c2ecf20Sopenharmony_ci#elif (BITS_PER_LONG == 64)
5378c2ecf20Sopenharmony_ci	writel(baddr >> 32, &regs->InfoPtrHi);
5388c2ecf20Sopenharmony_ci	writel(baddr & 0xffffffff, &regs->InfoPtrLo);
5398c2ecf20Sopenharmony_ci#else
5408c2ecf20Sopenharmony_ci	writel(0, &regs->InfoPtrHi);
5418c2ecf20Sopenharmony_ci	writel(baddr, &regs->InfoPtrLo);
5428c2ecf20Sopenharmony_ci#endif
5438c2ecf20Sopenharmony_ci	mb();
5448c2ecf20Sopenharmony_ci}
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_ci
5478c2ecf20Sopenharmony_ci/*
5488c2ecf20Sopenharmony_ci * TX ring
5498c2ecf20Sopenharmony_ci */
5508c2ecf20Sopenharmony_ci
5518c2ecf20Sopenharmony_ci#ifdef CONFIG_ROADRUNNER_LARGE_RINGS
5528c2ecf20Sopenharmony_ci#define TX_RING_ENTRIES	32
5538c2ecf20Sopenharmony_ci#else
5548c2ecf20Sopenharmony_ci#define TX_RING_ENTRIES	16
5558c2ecf20Sopenharmony_ci#endif
5568c2ecf20Sopenharmony_ci#define TX_TOTAL_SIZE	(TX_RING_ENTRIES * sizeof(struct tx_desc))
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_cistruct tx_desc{
5598c2ecf20Sopenharmony_ci	rraddr	addr;
5608c2ecf20Sopenharmony_ci	u32	res;
5618c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
5628c2ecf20Sopenharmony_ci	u16	size;
5638c2ecf20Sopenharmony_ci	u8	pad;
5648c2ecf20Sopenharmony_ci	u8	mode;
5658c2ecf20Sopenharmony_ci#else
5668c2ecf20Sopenharmony_ci	u8	mode;
5678c2ecf20Sopenharmony_ci	u8	pad;
5688c2ecf20Sopenharmony_ci	u16	size;
5698c2ecf20Sopenharmony_ci#endif
5708c2ecf20Sopenharmony_ci};
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ci#ifdef CONFIG_ROADRUNNER_LARGE_RINGS
5748c2ecf20Sopenharmony_ci#define RX_RING_ENTRIES	32
5758c2ecf20Sopenharmony_ci#else
5768c2ecf20Sopenharmony_ci#define RX_RING_ENTRIES 16
5778c2ecf20Sopenharmony_ci#endif
5788c2ecf20Sopenharmony_ci#define RX_TOTAL_SIZE	(RX_RING_ENTRIES * sizeof(struct rx_desc))
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_cistruct rx_desc{
5818c2ecf20Sopenharmony_ci	rraddr	addr;
5828c2ecf20Sopenharmony_ci	u32	res;
5838c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
5848c2ecf20Sopenharmony_ci	u16	size;
5858c2ecf20Sopenharmony_ci	u8	pad;
5868c2ecf20Sopenharmony_ci	u8	mode;
5878c2ecf20Sopenharmony_ci#else
5888c2ecf20Sopenharmony_ci	u8	mode;
5898c2ecf20Sopenharmony_ci	u8	pad;
5908c2ecf20Sopenharmony_ci	u16	size;
5918c2ecf20Sopenharmony_ci#endif
5928c2ecf20Sopenharmony_ci};
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ci
5958c2ecf20Sopenharmony_ci/*
5968c2ecf20Sopenharmony_ci * ioctl's
5978c2ecf20Sopenharmony_ci */
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci#define SIOCRRPFW	SIOCDEVPRIVATE		/* put firmware */
6008c2ecf20Sopenharmony_ci#define SIOCRRGFW	SIOCDEVPRIVATE+1	/* get firmware */
6018c2ecf20Sopenharmony_ci#define SIOCRRID	SIOCDEVPRIVATE+2	/* identify */
6028c2ecf20Sopenharmony_ci
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_cistruct seg_hdr {
6058c2ecf20Sopenharmony_ci	u32	seg_start;
6068c2ecf20Sopenharmony_ci	u32	seg_len;
6078c2ecf20Sopenharmony_ci	u32	seg_eestart;
6088c2ecf20Sopenharmony_ci};
6098c2ecf20Sopenharmony_ci
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci#define EEPROM_BASE 0x80000000
6128c2ecf20Sopenharmony_ci#define EEPROM_WORDS 8192
6138c2ecf20Sopenharmony_ci#define EEPROM_BYTES (EEPROM_WORDS * sizeof(u32))
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_cistruct eeprom_boot {
6168c2ecf20Sopenharmony_ci	u32	key1;
6178c2ecf20Sopenharmony_ci	u32	key2;
6188c2ecf20Sopenharmony_ci	u32	sram_size;
6198c2ecf20Sopenharmony_ci	struct	seg_hdr loader;
6208c2ecf20Sopenharmony_ci	u32	init_chksum;
6218c2ecf20Sopenharmony_ci	u32	reserved1;
6228c2ecf20Sopenharmony_ci};
6238c2ecf20Sopenharmony_ci
6248c2ecf20Sopenharmony_cistruct eeprom_manf {
6258c2ecf20Sopenharmony_ci	u32	HeaderFmt;
6268c2ecf20Sopenharmony_ci	u32	Firmware;
6278c2ecf20Sopenharmony_ci	u32	BoardRevision;
6288c2ecf20Sopenharmony_ci	u32	RoadrunnerRev;
6298c2ecf20Sopenharmony_ci	char	OpticsPart[8];
6308c2ecf20Sopenharmony_ci	u32	OpticsRev;
6318c2ecf20Sopenharmony_ci	u32	pad1;
6328c2ecf20Sopenharmony_ci	char	SramPart[8];
6338c2ecf20Sopenharmony_ci	u32	SramRev;
6348c2ecf20Sopenharmony_ci	u32	pad2;
6358c2ecf20Sopenharmony_ci	char	EepromPart[8];
6368c2ecf20Sopenharmony_ci	u32	EepromRev;
6378c2ecf20Sopenharmony_ci	u32	EepromSize;
6388c2ecf20Sopenharmony_ci	char	PalPart[8];
6398c2ecf20Sopenharmony_ci	u32	PalRev;
6408c2ecf20Sopenharmony_ci	u32	pad3;
6418c2ecf20Sopenharmony_ci	char	PalCodeFile[12];
6428c2ecf20Sopenharmony_ci	u32	PalCodeRev;
6438c2ecf20Sopenharmony_ci	char	BoardULA[8];
6448c2ecf20Sopenharmony_ci	char	SerialNo[8];
6458c2ecf20Sopenharmony_ci	char	MfgDate[8];
6468c2ecf20Sopenharmony_ci	char	MfgTime[8];
6478c2ecf20Sopenharmony_ci	char	ModifyDate[8];
6488c2ecf20Sopenharmony_ci	u32	ModCount;
6498c2ecf20Sopenharmony_ci	u32	pad4[13];
6508c2ecf20Sopenharmony_ci};
6518c2ecf20Sopenharmony_ci
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_cistruct eeprom_phase_info {
6548c2ecf20Sopenharmony_ci	char	phase1File[12];
6558c2ecf20Sopenharmony_ci	u32	phase1Rev;
6568c2ecf20Sopenharmony_ci	char	phase1Date[8];
6578c2ecf20Sopenharmony_ci	char	phase2File[12];
6588c2ecf20Sopenharmony_ci	u32	phase2Rev;
6598c2ecf20Sopenharmony_ci	char	phase2Date[8];
6608c2ecf20Sopenharmony_ci	u32	reserved7[4];
6618c2ecf20Sopenharmony_ci};
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_cistruct eeprom_rncd_info {
6648c2ecf20Sopenharmony_ci	u32	FwStart;
6658c2ecf20Sopenharmony_ci	u32	FwRev;
6668c2ecf20Sopenharmony_ci	char	FwDate[8];
6678c2ecf20Sopenharmony_ci	u32	AddrRunCodeSegs;
6688c2ecf20Sopenharmony_ci	u32	FileNames;
6698c2ecf20Sopenharmony_ci	char	File[13][8];
6708c2ecf20Sopenharmony_ci};
6718c2ecf20Sopenharmony_ci
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_ci/* Phase 1 region (starts are word offset 0x80) */
6748c2ecf20Sopenharmony_cistruct phase1_hdr{
6758c2ecf20Sopenharmony_ci	u32	jump;
6768c2ecf20Sopenharmony_ci	u32	noop;
6778c2ecf20Sopenharmony_ci	struct seg_hdr phase2Seg;
6788c2ecf20Sopenharmony_ci};
6798c2ecf20Sopenharmony_ci
6808c2ecf20Sopenharmony_cistruct eeprom {
6818c2ecf20Sopenharmony_ci	struct eeprom_boot	boot;
6828c2ecf20Sopenharmony_ci	u32			pad1[8];
6838c2ecf20Sopenharmony_ci	struct eeprom_manf	manf;
6848c2ecf20Sopenharmony_ci	struct eeprom_phase_info phase_info;
6858c2ecf20Sopenharmony_ci	struct eeprom_rncd_info	rncd_info;
6868c2ecf20Sopenharmony_ci	u32			pad2[15];
6878c2ecf20Sopenharmony_ci	u32			hdr_checksum;
6888c2ecf20Sopenharmony_ci	struct phase1_hdr	phase1;
6898c2ecf20Sopenharmony_ci};
6908c2ecf20Sopenharmony_ci
6918c2ecf20Sopenharmony_ci
6928c2ecf20Sopenharmony_cistruct rr_stats {
6938c2ecf20Sopenharmony_ci	u32	NicTimeStamp;
6948c2ecf20Sopenharmony_ci	u32	RngCreated;
6958c2ecf20Sopenharmony_ci	u32	RngDeleted;
6968c2ecf20Sopenharmony_ci	u32	IntrGen;
6978c2ecf20Sopenharmony_ci	u32	NEvtOvfl;
6988c2ecf20Sopenharmony_ci	u32	InvCmd;
6998c2ecf20Sopenharmony_ci	u32	DmaReadErrs;
7008c2ecf20Sopenharmony_ci	u32	DmaWriteErrs;
7018c2ecf20Sopenharmony_ci	u32	StatUpdtT;
7028c2ecf20Sopenharmony_ci	u32	StatUpdtC;
7038c2ecf20Sopenharmony_ci	u32	WatchDog;
7048c2ecf20Sopenharmony_ci	u32	Trace;
7058c2ecf20Sopenharmony_ci
7068c2ecf20Sopenharmony_ci	/* Serial HIPPI */
7078c2ecf20Sopenharmony_ci	u32	LnkRdyEst;
7088c2ecf20Sopenharmony_ci	u32	GLinkErr;
7098c2ecf20Sopenharmony_ci	u32	AltFlgErr;
7108c2ecf20Sopenharmony_ci	u32	OvhdBit8Sync;
7118c2ecf20Sopenharmony_ci	u32	RmtSerPrtyErr;
7128c2ecf20Sopenharmony_ci	u32	RmtParPrtyErr;
7138c2ecf20Sopenharmony_ci	u32	RmtLoopBk;
7148c2ecf20Sopenharmony_ci	u32	pad1;
7158c2ecf20Sopenharmony_ci
7168c2ecf20Sopenharmony_ci	/* HIPPI tx */
7178c2ecf20Sopenharmony_ci	u32	ConEst;
7188c2ecf20Sopenharmony_ci	u32	ConRejS;
7198c2ecf20Sopenharmony_ci	u32	ConRetry;
7208c2ecf20Sopenharmony_ci	u32	ConTmOut;
7218c2ecf20Sopenharmony_ci	u32	SndConDiscon;
7228c2ecf20Sopenharmony_ci	u32	SndParErr;
7238c2ecf20Sopenharmony_ci	u32	PktSnt;
7248c2ecf20Sopenharmony_ci	u32	pad2[2];
7258c2ecf20Sopenharmony_ci	u32	ShFBstSnt;
7268c2ecf20Sopenharmony_ci	u64	BytSent;
7278c2ecf20Sopenharmony_ci	u32	TxTimeout;
7288c2ecf20Sopenharmony_ci	u32	pad3[3];
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci	/* HIPPI rx */
7318c2ecf20Sopenharmony_ci	u32	ConAcc;
7328c2ecf20Sopenharmony_ci	u32	ConRejdiPrty;
7338c2ecf20Sopenharmony_ci	u32	ConRejd64b;
7348c2ecf20Sopenharmony_ci	u32	ConRejdBuf;
7358c2ecf20Sopenharmony_ci	u32	RxConDiscon;
7368c2ecf20Sopenharmony_ci	u32	RxConNoData;
7378c2ecf20Sopenharmony_ci	u32	PktRx;
7388c2ecf20Sopenharmony_ci	u32	pad4[2];
7398c2ecf20Sopenharmony_ci	u32	ShFBstRx;
7408c2ecf20Sopenharmony_ci	u64	BytRx;
7418c2ecf20Sopenharmony_ci	u32	RxParErr;
7428c2ecf20Sopenharmony_ci	u32	RxLLRCerr;
7438c2ecf20Sopenharmony_ci	u32	RxBstSZerr;
7448c2ecf20Sopenharmony_ci	u32	RxStateErr;
7458c2ecf20Sopenharmony_ci	u32	RxRdyErr;
7468c2ecf20Sopenharmony_ci	u32	RxInvULP;
7478c2ecf20Sopenharmony_ci	u32	RxSpcBuf;
7488c2ecf20Sopenharmony_ci	u32	RxSpcDesc;
7498c2ecf20Sopenharmony_ci	u32	RxRngSpc;
7508c2ecf20Sopenharmony_ci	u32	RxRngFull;
7518c2ecf20Sopenharmony_ci	u32	RxPktLenErr;
7528c2ecf20Sopenharmony_ci	u32	RxCksmErr;
7538c2ecf20Sopenharmony_ci	u32	RxPktDrp;
7548c2ecf20Sopenharmony_ci	u32	RngLowSpc;
7558c2ecf20Sopenharmony_ci	u32	RngDataClose;
7568c2ecf20Sopenharmony_ci	u32	RxTimeout;
7578c2ecf20Sopenharmony_ci	u32	RxIdle;
7588c2ecf20Sopenharmony_ci};
7598c2ecf20Sopenharmony_ci
7608c2ecf20Sopenharmony_ci
7618c2ecf20Sopenharmony_ci/*
7628c2ecf20Sopenharmony_ci * This struct is shared with the NIC firmware.
7638c2ecf20Sopenharmony_ci */
7648c2ecf20Sopenharmony_cistruct ring_ctrl {
7658c2ecf20Sopenharmony_ci	rraddr	rngptr;
7668c2ecf20Sopenharmony_ci#ifdef __LITTLE_ENDIAN
7678c2ecf20Sopenharmony_ci	u16	entries;
7688c2ecf20Sopenharmony_ci	u8	pad;
7698c2ecf20Sopenharmony_ci	u8	entry_size;
7708c2ecf20Sopenharmony_ci	u16	pi;
7718c2ecf20Sopenharmony_ci	u16	mode;
7728c2ecf20Sopenharmony_ci#else
7738c2ecf20Sopenharmony_ci	u8	entry_size;
7748c2ecf20Sopenharmony_ci	u8	pad;
7758c2ecf20Sopenharmony_ci	u16	entries;
7768c2ecf20Sopenharmony_ci	u16	mode;
7778c2ecf20Sopenharmony_ci	u16	pi;
7788c2ecf20Sopenharmony_ci#endif
7798c2ecf20Sopenharmony_ci};
7808c2ecf20Sopenharmony_ci
7818c2ecf20Sopenharmony_cistruct rr_info {
7828c2ecf20Sopenharmony_ci	union {
7838c2ecf20Sopenharmony_ci		struct rr_stats stats;
7848c2ecf20Sopenharmony_ci		u32 stati[128];
7858c2ecf20Sopenharmony_ci	} s;
7868c2ecf20Sopenharmony_ci	struct ring_ctrl	evt_ctrl;
7878c2ecf20Sopenharmony_ci	struct ring_ctrl	cmd_ctrl;
7888c2ecf20Sopenharmony_ci	struct ring_ctrl	tx_ctrl;
7898c2ecf20Sopenharmony_ci	u8			pad[464];
7908c2ecf20Sopenharmony_ci	u8			trace[3072];
7918c2ecf20Sopenharmony_ci};
7928c2ecf20Sopenharmony_ci
7938c2ecf20Sopenharmony_ci/*
7948c2ecf20Sopenharmony_ci * The linux structure for the RoadRunner.
7958c2ecf20Sopenharmony_ci *
7968c2ecf20Sopenharmony_ci * RX/TX descriptors are put first to make sure they are properly
7978c2ecf20Sopenharmony_ci * aligned and do not cross cache-line boundaries.
7988c2ecf20Sopenharmony_ci */
7998c2ecf20Sopenharmony_ci
8008c2ecf20Sopenharmony_cistruct rr_private
8018c2ecf20Sopenharmony_ci{
8028c2ecf20Sopenharmony_ci	struct rx_desc		*rx_ring;
8038c2ecf20Sopenharmony_ci	struct tx_desc		*tx_ring;
8048c2ecf20Sopenharmony_ci	struct event		*evt_ring;
8058c2ecf20Sopenharmony_ci	dma_addr_t 		tx_ring_dma;
8068c2ecf20Sopenharmony_ci	dma_addr_t 		rx_ring_dma;
8078c2ecf20Sopenharmony_ci	dma_addr_t 		evt_ring_dma;
8088c2ecf20Sopenharmony_ci	/* Alignment ok ? */
8098c2ecf20Sopenharmony_ci	struct sk_buff		*rx_skbuff[RX_RING_ENTRIES];
8108c2ecf20Sopenharmony_ci	struct sk_buff		*tx_skbuff[TX_RING_ENTRIES];
8118c2ecf20Sopenharmony_ci	struct rr_regs		__iomem *regs;		/* Register base */
8128c2ecf20Sopenharmony_ci	struct ring_ctrl	*rx_ctrl;	/* Receive ring control */
8138c2ecf20Sopenharmony_ci	struct rr_info		*info;		/* Shared info page */
8148c2ecf20Sopenharmony_ci	dma_addr_t 		rx_ctrl_dma;
8158c2ecf20Sopenharmony_ci	dma_addr_t 		info_dma;
8168c2ecf20Sopenharmony_ci	spinlock_t		lock;
8178c2ecf20Sopenharmony_ci	struct timer_list	timer;
8188c2ecf20Sopenharmony_ci	u32			cur_rx, cur_cmd, cur_evt;
8198c2ecf20Sopenharmony_ci	u32			dirty_rx, dirty_tx;
8208c2ecf20Sopenharmony_ci	u32			tx_full;
8218c2ecf20Sopenharmony_ci	u32			fw_rev;
8228c2ecf20Sopenharmony_ci	volatile short		fw_running;
8238c2ecf20Sopenharmony_ci	struct pci_dev		*pci_dev;
8248c2ecf20Sopenharmony_ci};
8258c2ecf20Sopenharmony_ci
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_ci/*
8288c2ecf20Sopenharmony_ci * Prototypes
8298c2ecf20Sopenharmony_ci */
8308c2ecf20Sopenharmony_cistatic int rr_init(struct net_device *dev);
8318c2ecf20Sopenharmony_cistatic int rr_init1(struct net_device *dev);
8328c2ecf20Sopenharmony_cistatic irqreturn_t rr_interrupt(int irq, void *dev_id);
8338c2ecf20Sopenharmony_ci
8348c2ecf20Sopenharmony_cistatic int rr_open(struct net_device *dev);
8358c2ecf20Sopenharmony_cistatic netdev_tx_t rr_start_xmit(struct sk_buff *skb,
8368c2ecf20Sopenharmony_ci				 struct net_device *dev);
8378c2ecf20Sopenharmony_cistatic int rr_close(struct net_device *dev);
8388c2ecf20Sopenharmony_cistatic int rr_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
8398c2ecf20Sopenharmony_cistatic unsigned int rr_read_eeprom(struct rr_private *rrpriv,
8408c2ecf20Sopenharmony_ci				   unsigned long offset,
8418c2ecf20Sopenharmony_ci				   unsigned char *buf,
8428c2ecf20Sopenharmony_ci				   unsigned long length);
8438c2ecf20Sopenharmony_cistatic u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset);
8448c2ecf20Sopenharmony_cistatic int rr_load_firmware(struct net_device *dev);
8458c2ecf20Sopenharmony_cistatic inline void rr_raz_tx(struct rr_private *, struct net_device *);
8468c2ecf20Sopenharmony_cistatic inline void rr_raz_rx(struct rr_private *, struct net_device *);
8478c2ecf20Sopenharmony_ci#endif /* _RRUNNER_H_ */
848