xref: /titanic_50/usr/src/grub/grub-0.97/netboot/epic100.h (revision 1b8adde7ba7d5e04395c141c5400dc2cffd7d809)
1*1b8adde7SWilliam Kucharski #ifndef	_EPIC100_H_
2*1b8adde7SWilliam Kucharski # define _EPIC100_H_
3*1b8adde7SWilliam Kucharski 
4*1b8adde7SWilliam Kucharski #ifndef	PCI_VENDOR_SMC
5*1b8adde7SWilliam Kucharski # define PCI_VENDOR_SMC		0x10B8
6*1b8adde7SWilliam Kucharski #endif
7*1b8adde7SWilliam Kucharski 
8*1b8adde7SWilliam Kucharski #ifndef	PCI_DEVICE_SMC_EPIC100
9*1b8adde7SWilliam Kucharski # define PCI_DEVICE_SMC_EPIC100	0x0005
10*1b8adde7SWilliam Kucharski #endif
11*1b8adde7SWilliam Kucharski 
12*1b8adde7SWilliam Kucharski #define PCI_DEVICE_ID_NONE	0xFFFF
13*1b8adde7SWilliam Kucharski 
14*1b8adde7SWilliam Kucharski /* Offsets to registers (using SMC names). */
15*1b8adde7SWilliam Kucharski enum epic100_registers {
16*1b8adde7SWilliam Kucharski     COMMAND= 0,		/* Control Register */
17*1b8adde7SWilliam Kucharski     INTSTAT= 4,		/* Interrupt Status */
18*1b8adde7SWilliam Kucharski     INTMASK= 8,		/* Interrupt Mask */
19*1b8adde7SWilliam Kucharski     GENCTL = 0x0C,	/* General Control */
20*1b8adde7SWilliam Kucharski     NVCTL  = 0x10,	/* Non Volatile Control */
21*1b8adde7SWilliam Kucharski     EECTL  = 0x14,	/* EEPROM Control  */
22*1b8adde7SWilliam Kucharski     TEST   = 0x1C,	/* Test register: marked as reserved (see in source code) */
23*1b8adde7SWilliam Kucharski     CRCCNT = 0x20,	/* CRC Error Counter */
24*1b8adde7SWilliam Kucharski     ALICNT = 0x24,	/* Frame Alignment Error Counter */
25*1b8adde7SWilliam Kucharski     MPCNT  = 0x28,	/* Missed Packet Counter */
26*1b8adde7SWilliam Kucharski     MMCTL  = 0x30,	/* MII Management Interface Control */
27*1b8adde7SWilliam Kucharski     MMDATA = 0x34,	/* MII Management Interface Data */
28*1b8adde7SWilliam Kucharski     MIICFG = 0x38,	/* MII Configuration */
29*1b8adde7SWilliam Kucharski     IPG    = 0x3C,	/* InterPacket Gap */
30*1b8adde7SWilliam Kucharski     LAN0   = 0x40,	/* MAC address. (0x40-0x48) */
31*1b8adde7SWilliam Kucharski     IDCHK  = 0x4C,	/* BoardID/ Checksum */
32*1b8adde7SWilliam Kucharski     MC0    = 0x50,	/* Multicast filter table. (0x50-0x5c) */
33*1b8adde7SWilliam Kucharski     RXCON  = 0x60,	/* Receive Control */
34*1b8adde7SWilliam Kucharski     TXCON  = 0x70,	/* Transmit Control */
35*1b8adde7SWilliam Kucharski     TXSTAT = 0x74,	/* Transmit Status */
36*1b8adde7SWilliam Kucharski     PRCDAR = 0x84,	/* PCI Receive Current Descriptor Address */
37*1b8adde7SWilliam Kucharski     PRSTAT = 0xA4,	/* PCI Receive DMA Status */
38*1b8adde7SWilliam Kucharski     PRCPTHR= 0xB0,	/* PCI Receive Copy Threshold */
39*1b8adde7SWilliam Kucharski     PTCDAR = 0xC4,	/* PCI Transmit Current Descriptor Address */
40*1b8adde7SWilliam Kucharski     ETHTHR = 0xDC	/* Early Transmit Threshold */
41*1b8adde7SWilliam Kucharski };
42*1b8adde7SWilliam Kucharski 
43*1b8adde7SWilliam Kucharski /* Command register (CR_) bits */
44*1b8adde7SWilliam Kucharski #define CR_STOP_RX		(0x00000001)
45*1b8adde7SWilliam Kucharski #define CR_START_RX		(0x00000002)
46*1b8adde7SWilliam Kucharski #define CR_QUEUE_TX		(0x00000004)
47*1b8adde7SWilliam Kucharski #define CR_QUEUE_RX		(0x00000008)
48*1b8adde7SWilliam Kucharski #define CR_NEXTFRAME		(0x00000010)
49*1b8adde7SWilliam Kucharski #define CR_STOP_TX_DMA		(0x00000020)
50*1b8adde7SWilliam Kucharski #define CR_STOP_RX_DMA		(0x00000040)
51*1b8adde7SWilliam Kucharski #define CR_TX_UGO		(0x00000080)
52*1b8adde7SWilliam Kucharski 
53*1b8adde7SWilliam Kucharski /* Interrupt register bits. NI means No Interrupt generated */
54*1b8adde7SWilliam Kucharski 
55*1b8adde7SWilliam Kucharski #define	INTR_RX_THR_STA		(0x00400000)	/* rx copy threshold status NI */
56*1b8adde7SWilliam Kucharski #define	INTR_RX_BUFF_EMPTY	(0x00200000)	/* rx buffers empty. NI */
57*1b8adde7SWilliam Kucharski #define	INTR_TX_IN_PROG		(0x00100000)	/* tx copy in progess. NI */
58*1b8adde7SWilliam Kucharski #define	INTR_RX_IN_PROG		(0x00080000)	/* rx copy in progress. NI */
59*1b8adde7SWilliam Kucharski #define	INTR_TXIDLE		(0x00040000)	/* tx idle. NI */
60*1b8adde7SWilliam Kucharski #define INTR_RXIDLE		(0x00020000)	/* rx idle. NI */
61*1b8adde7SWilliam Kucharski #define INTR_INTR_ACTIVE	(0x00010000)	/* Interrupt active. NI */
62*1b8adde7SWilliam Kucharski #define INTR_RX_STATUS_OK	(0x00008000)	/* rx status valid. NI */
63*1b8adde7SWilliam Kucharski #define INTR_PCI_TGT_ABT	(0x00004000)	/* PCI Target abort */
64*1b8adde7SWilliam Kucharski #define INTR_PCI_MASTER_ABT	(0x00002000)	/* PCI Master abort */
65*1b8adde7SWilliam Kucharski #define INTR_PCI_PARITY_ERR	(0x00001000)	/* PCI adress parity error */
66*1b8adde7SWilliam Kucharski #define INTR_PCI_DATA_ERR	(0x00000800)	/* PCI data parity error */
67*1b8adde7SWilliam Kucharski #define INTR_RX_THR_CROSSED	(0x00000400)	/* rx copy threshold crossed */
68*1b8adde7SWilliam Kucharski #define INTR_CNTFULL		(0x00000200)	/* Counter overflow */
69*1b8adde7SWilliam Kucharski #define INTR_TXUNDERRUN		(0x00000100)	/* tx underrun. */
70*1b8adde7SWilliam Kucharski #define INTR_TXEMPTY		(0x00000080)	/* tx queue empty */
71*1b8adde7SWilliam Kucharski #define INTR_TX_CH_COMPLETE	(0x00000040)	/* tx chain complete */
72*1b8adde7SWilliam Kucharski #define INTR_TXDONE		(0x00000020)	/* tx complete (w or w/o err) */
73*1b8adde7SWilliam Kucharski #define INTR_RXERROR		(0x00000010)	/* rx error (CRC) */
74*1b8adde7SWilliam Kucharski #define INTR_RXOVERFLOW		(0x00000008)	/* rx buffer overflow */
75*1b8adde7SWilliam Kucharski #define INTR_RX_QUEUE_EMPTY	(0x00000004)	/* rx queue empty. */
76*1b8adde7SWilliam Kucharski #define INTR_RXHEADER		(0x00000002)	/* header copy complete */
77*1b8adde7SWilliam Kucharski #define INTR_RXDONE		(0x00000001)	/* Receive copy complete */
78*1b8adde7SWilliam Kucharski 
79*1b8adde7SWilliam Kucharski #define INTR_CLEARINTR		(0x00007FFF)
80*1b8adde7SWilliam Kucharski #define INTR_VALIDBITS		(0x007FFFFF)
81*1b8adde7SWilliam Kucharski #define INTR_DISABLE		(0x00000000)
82*1b8adde7SWilliam Kucharski #define INTR_CLEARERRS		(0x00007F18)
83*1b8adde7SWilliam Kucharski #define INTR_ABNINTR		(INTR_CNTFULL | INTR_TXUNDERRUN | INTR_RXOVERFLOW)
84*1b8adde7SWilliam Kucharski 
85*1b8adde7SWilliam Kucharski /* General Control (GC_) bits */
86*1b8adde7SWilliam Kucharski 
87*1b8adde7SWilliam Kucharski #define GC_SOFT_RESET		(0x00000001)
88*1b8adde7SWilliam Kucharski #define GC_INTR_ENABLE		(0x00000002)
89*1b8adde7SWilliam Kucharski #define GC_SOFT_INTR		(0x00000004)
90*1b8adde7SWilliam Kucharski #define GC_POWER_DOWN		(0x00000008)
91*1b8adde7SWilliam Kucharski #define GC_ONE_COPY		(0x00000010)
92*1b8adde7SWilliam Kucharski #define GC_BIG_ENDIAN		(0x00000020)
93*1b8adde7SWilliam Kucharski #define GC_RX_PREEMPT_TX	(0x00000040)
94*1b8adde7SWilliam Kucharski #define GC_TX_PREEMPT_RX	(0x00000080)
95*1b8adde7SWilliam Kucharski 
96*1b8adde7SWilliam Kucharski /*
97*1b8adde7SWilliam Kucharski  * Receive FIFO Threshold values
98*1b8adde7SWilliam Kucharski  * Control the level at which the  PCI burst state machine
99*1b8adde7SWilliam Kucharski  * begins to empty the receive FIFO. Possible values: 0-3
100*1b8adde7SWilliam Kucharski  *
101*1b8adde7SWilliam Kucharski  * 0 => 32, 1 => 64, 2 => 96 3 => 128 bytes.
102*1b8adde7SWilliam Kucharski  */
103*1b8adde7SWilliam Kucharski #define GC_RX_FIFO_THR_32	(0x00000000)
104*1b8adde7SWilliam Kucharski #define GC_RX_FIFO_THR_64	(0x00000100)
105*1b8adde7SWilliam Kucharski #define GC_RX_FIFO_THR_96	(0x00000200)
106*1b8adde7SWilliam Kucharski #define GC_RX_FIFO_THR_128	(0x00000300)
107*1b8adde7SWilliam Kucharski 
108*1b8adde7SWilliam Kucharski /* Memory Read Control (MRC_) values */
109*1b8adde7SWilliam Kucharski #define GC_MRC_MEM_READ		(0x00000000)
110*1b8adde7SWilliam Kucharski #define GC_MRC_READ_MULT	(0x00000400)
111*1b8adde7SWilliam Kucharski #define GC_MRC_READ_LINE	(0x00000800)
112*1b8adde7SWilliam Kucharski 
113*1b8adde7SWilliam Kucharski #define GC_SOFTBIT0		(0x00001000)
114*1b8adde7SWilliam Kucharski #define GC_SOFTBIT1		(0x00002000)
115*1b8adde7SWilliam Kucharski #define GC_RESET_PHY		(0x00004000)
116*1b8adde7SWilliam Kucharski 
117*1b8adde7SWilliam Kucharski /* Definitions of the Receive Control (RC_) register bits */
118*1b8adde7SWilliam Kucharski 
119*1b8adde7SWilliam Kucharski #define RC_SAVE_ERRORED_PKT	(0x00000001)
120*1b8adde7SWilliam Kucharski #define RC_SAVE_RUNT_FRAMES	(0x00000002)
121*1b8adde7SWilliam Kucharski #define RC_RCV_BROADCAST	(0x00000004)
122*1b8adde7SWilliam Kucharski #define RC_RCV_MULTICAST	(0x00000008)
123*1b8adde7SWilliam Kucharski #define RC_RCV_INVERSE_PKT	(0x00000010)
124*1b8adde7SWilliam Kucharski #define RC_PROMISCUOUS_MODE	(0x00000020)
125*1b8adde7SWilliam Kucharski #define RC_MONITOR_MODE		(0x00000040)
126*1b8adde7SWilliam Kucharski #define RC_EARLY_RCV_ENABLE	(0x00000080)
127*1b8adde7SWilliam Kucharski 
128*1b8adde7SWilliam Kucharski /* description of the rx descriptors control bits */
129*1b8adde7SWilliam Kucharski #define RD_FRAGLIST		(0x0001)	/* Desc points to a fragment list */
130*1b8adde7SWilliam Kucharski #define RD_LLFORM		(0x0002)	/* Frag list format */
131*1b8adde7SWilliam Kucharski #define RD_HDR_CPY		(0x0004)	/* Desc used for header copy */
132*1b8adde7SWilliam Kucharski 
133*1b8adde7SWilliam Kucharski /* Definition of the Transmit CONTROL (TC) register bits */
134*1b8adde7SWilliam Kucharski 
135*1b8adde7SWilliam Kucharski #define TC_EARLY_TX_ENABLE	(0x00000001)
136*1b8adde7SWilliam Kucharski 
137*1b8adde7SWilliam Kucharski /* Loopback Mode (LM_) Select valuesbits */
138*1b8adde7SWilliam Kucharski #define TC_LM_NORMAL		(0x00000000)
139*1b8adde7SWilliam Kucharski #define TC_LM_INTERNAL		(0x00000002)
140*1b8adde7SWilliam Kucharski #define TC_LM_EXTERNAL		(0x00000004)
141*1b8adde7SWilliam Kucharski #define TC_LM_FULL_DPX		(0x00000006)
142*1b8adde7SWilliam Kucharski 
143*1b8adde7SWilliam Kucharski #define TX_SLOT_TIME		(0x00000078)
144*1b8adde7SWilliam Kucharski 
145*1b8adde7SWilliam Kucharski /* Bytes transferred to chip before transmission starts. */
146*1b8adde7SWilliam Kucharski #define TX_FIFO_THRESH		128	/* Rounded down to 4 byte units. */
147*1b8adde7SWilliam Kucharski 
148*1b8adde7SWilliam Kucharski /* description of rx descriptors status bits */
149*1b8adde7SWilliam Kucharski #define RRING_PKT_INTACT	(0x0001)
150*1b8adde7SWilliam Kucharski #define RRING_ALIGN_ERR		(0x0002)
151*1b8adde7SWilliam Kucharski #define RRING_CRC_ERR		(0x0004)
152*1b8adde7SWilliam Kucharski #define RRING_MISSED_PKT	(0x0008)
153*1b8adde7SWilliam Kucharski #define RRING_MULTICAST		(0x0010)
154*1b8adde7SWilliam Kucharski #define RRING_BROADCAST		(0x0020)
155*1b8adde7SWilliam Kucharski #define RRING_RECEIVER_DISABLE	(0x0040)
156*1b8adde7SWilliam Kucharski #define RRING_STATUS_VALID	(0x1000)
157*1b8adde7SWilliam Kucharski #define RRING_FRAGLIST_ERR	(0x2000)
158*1b8adde7SWilliam Kucharski #define RRING_HDR_COPIED	(0x4000)
159*1b8adde7SWilliam Kucharski #define RRING_OWN		(0x8000)
160*1b8adde7SWilliam Kucharski 
161*1b8adde7SWilliam Kucharski /* error summary */
162*1b8adde7SWilliam Kucharski #define RRING_ERROR		(RRING_ALIGN_ERR|RRING_CRC_ERR)
163*1b8adde7SWilliam Kucharski 
164*1b8adde7SWilliam Kucharski /* description of tx descriptors status bits */
165*1b8adde7SWilliam Kucharski #define TRING_PKT_INTACT	(0x0001)	/* pkt transmitted. */
166*1b8adde7SWilliam Kucharski #define TRING_PKT_NONDEFER	(0x0002)	/* pkt xmitted w/o deferring */
167*1b8adde7SWilliam Kucharski #define TRING_COLL		(0x0004)	/* pkt xmitted w collisions */
168*1b8adde7SWilliam Kucharski #define TRING_CARR		(0x0008)	/* carrier sense lost */
169*1b8adde7SWilliam Kucharski #define TRING_UNDERRUN		(0x0010)	/* DMA underrun */
170*1b8adde7SWilliam Kucharski #define TRING_HB_COLL		(0x0020)	/* Collision detect Heartbeat */
171*1b8adde7SWilliam Kucharski #define TRING_WIN_COLL		(0x0040)	/* out of window collision */
172*1b8adde7SWilliam Kucharski #define TRING_DEFERRED		(0x0080)	/* Deferring */
173*1b8adde7SWilliam Kucharski #define TRING_COLL_COUNT	(0x0F00)	/* collision counter (mask) */
174*1b8adde7SWilliam Kucharski #define TRING_COLL_EXCESS	(0x1000)	/* tx aborted: excessive colls */
175*1b8adde7SWilliam Kucharski #define TRING_OWN		(0x8000)	/* desc ownership bit */
176*1b8adde7SWilliam Kucharski 
177*1b8adde7SWilliam Kucharski /* error summary */
178*1b8adde7SWilliam Kucharski #define TRING_ABORT	(TRING_COLL_EXCESS|TRING_WIN_COLL|TRING_UNDERRUN)
179*1b8adde7SWilliam Kucharski #define TRING_ERROR	(TRING_DEFERRED|TRING_WIN_COLL|TRING_UNDERRUN|TRING_CARR/*|TRING_COLL*/ )
180*1b8adde7SWilliam Kucharski 
181*1b8adde7SWilliam Kucharski /* description of the tx descriptors control bits */
182*1b8adde7SWilliam Kucharski #define TD_FRAGLIST		(0x0001)	/* Desc points to a fragment list */
183*1b8adde7SWilliam Kucharski #define TD_LLFORM		(0x0002)	/* Frag list format */
184*1b8adde7SWilliam Kucharski #define TD_IAF			(0x0004)	/* Generate Interrupt after tx */
185*1b8adde7SWilliam Kucharski #define TD_NOCRC		(0x0008)	/* No CRC generated */
186*1b8adde7SWilliam Kucharski #define TD_LASTDESC		(0x0010)	/* Last desc for this frame */
187*1b8adde7SWilliam Kucharski 
188*1b8adde7SWilliam Kucharski #endif	/* _EPIC100_H_ */
189