xref: /linux/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h (revision 7f9664525f9cb507de9198a395a111371413f230)
1aa43c215SJeff Kirsher /*
2aa43c215SJeff Kirsher  * QLogic qlcnic NIC Driver
3aa43c215SJeff Kirsher  * Copyright (c)  2009-2010 QLogic Corporation
4aa43c215SJeff Kirsher  *
5aa43c215SJeff Kirsher  * See LICENSE.qlcnic for copyright and licensing details.
6aa43c215SJeff Kirsher  */
7aa43c215SJeff Kirsher 
8aa43c215SJeff Kirsher #ifndef __QLCNIC_HDR_H_
9aa43c215SJeff Kirsher #define __QLCNIC_HDR_H_
10aa43c215SJeff Kirsher 
11aa43c215SJeff Kirsher #include <linux/kernel.h>
12aa43c215SJeff Kirsher #include <linux/types.h>
13aa43c215SJeff Kirsher 
147e2cf4feSSony Chacko #include "qlcnic_hw.h"
157e2cf4feSSony Chacko 
16aa43c215SJeff Kirsher /*
17aa43c215SJeff Kirsher  * The basic unit of access when reading/writing control registers.
18aa43c215SJeff Kirsher  */
19aa43c215SJeff Kirsher 
20aa43c215SJeff Kirsher enum {
21aa43c215SJeff Kirsher 	QLCNIC_HW_H0_CH_HUB_ADR = 0x05,
22aa43c215SJeff Kirsher 	QLCNIC_HW_H1_CH_HUB_ADR = 0x0E,
23aa43c215SJeff Kirsher 	QLCNIC_HW_H2_CH_HUB_ADR = 0x03,
24aa43c215SJeff Kirsher 	QLCNIC_HW_H3_CH_HUB_ADR = 0x01,
25aa43c215SJeff Kirsher 	QLCNIC_HW_H4_CH_HUB_ADR = 0x06,
26aa43c215SJeff Kirsher 	QLCNIC_HW_H5_CH_HUB_ADR = 0x07,
27aa43c215SJeff Kirsher 	QLCNIC_HW_H6_CH_HUB_ADR = 0x08
28aa43c215SJeff Kirsher };
29aa43c215SJeff Kirsher 
30aa43c215SJeff Kirsher /*  Hub 0 */
31aa43c215SJeff Kirsher enum {
32aa43c215SJeff Kirsher 	QLCNIC_HW_MN_CRB_AGT_ADR = 0x15,
33aa43c215SJeff Kirsher 	QLCNIC_HW_MS_CRB_AGT_ADR = 0x25
34aa43c215SJeff Kirsher };
35aa43c215SJeff Kirsher 
36aa43c215SJeff Kirsher /*  Hub 1 */
37aa43c215SJeff Kirsher enum {
38aa43c215SJeff Kirsher 	QLCNIC_HW_PS_CRB_AGT_ADR = 0x73,
39aa43c215SJeff Kirsher 	QLCNIC_HW_SS_CRB_AGT_ADR = 0x20,
40aa43c215SJeff Kirsher 	QLCNIC_HW_RPMX3_CRB_AGT_ADR = 0x0b,
41aa43c215SJeff Kirsher 	QLCNIC_HW_QMS_CRB_AGT_ADR = 0x00,
42aa43c215SJeff Kirsher 	QLCNIC_HW_SQGS0_CRB_AGT_ADR = 0x01,
43aa43c215SJeff Kirsher 	QLCNIC_HW_SQGS1_CRB_AGT_ADR = 0x02,
44aa43c215SJeff Kirsher 	QLCNIC_HW_SQGS2_CRB_AGT_ADR = 0x03,
45aa43c215SJeff Kirsher 	QLCNIC_HW_SQGS3_CRB_AGT_ADR = 0x04,
46aa43c215SJeff Kirsher 	QLCNIC_HW_C2C0_CRB_AGT_ADR = 0x58,
47aa43c215SJeff Kirsher 	QLCNIC_HW_C2C1_CRB_AGT_ADR = 0x59,
48aa43c215SJeff Kirsher 	QLCNIC_HW_C2C2_CRB_AGT_ADR = 0x5a,
49aa43c215SJeff Kirsher 	QLCNIC_HW_RPMX2_CRB_AGT_ADR = 0x0a,
50aa43c215SJeff Kirsher 	QLCNIC_HW_RPMX4_CRB_AGT_ADR = 0x0c,
51aa43c215SJeff Kirsher 	QLCNIC_HW_RPMX7_CRB_AGT_ADR = 0x0f,
52aa43c215SJeff Kirsher 	QLCNIC_HW_RPMX9_CRB_AGT_ADR = 0x12,
53aa43c215SJeff Kirsher 	QLCNIC_HW_SMB_CRB_AGT_ADR = 0x18
54aa43c215SJeff Kirsher };
55aa43c215SJeff Kirsher 
56aa43c215SJeff Kirsher /*  Hub 2 */
57aa43c215SJeff Kirsher enum {
58aa43c215SJeff Kirsher 	QLCNIC_HW_NIU_CRB_AGT_ADR = 0x31,
59aa43c215SJeff Kirsher 	QLCNIC_HW_I2C0_CRB_AGT_ADR = 0x19,
60aa43c215SJeff Kirsher 	QLCNIC_HW_I2C1_CRB_AGT_ADR = 0x29,
61aa43c215SJeff Kirsher 
62aa43c215SJeff Kirsher 	QLCNIC_HW_SN_CRB_AGT_ADR = 0x10,
63aa43c215SJeff Kirsher 	QLCNIC_HW_I2Q_CRB_AGT_ADR = 0x20,
64aa43c215SJeff Kirsher 	QLCNIC_HW_LPC_CRB_AGT_ADR = 0x22,
65aa43c215SJeff Kirsher 	QLCNIC_HW_ROMUSB_CRB_AGT_ADR = 0x21,
66aa43c215SJeff Kirsher 	QLCNIC_HW_QM_CRB_AGT_ADR = 0x66,
67aa43c215SJeff Kirsher 	QLCNIC_HW_SQG0_CRB_AGT_ADR = 0x60,
68aa43c215SJeff Kirsher 	QLCNIC_HW_SQG1_CRB_AGT_ADR = 0x61,
69aa43c215SJeff Kirsher 	QLCNIC_HW_SQG2_CRB_AGT_ADR = 0x62,
70aa43c215SJeff Kirsher 	QLCNIC_HW_SQG3_CRB_AGT_ADR = 0x63,
71aa43c215SJeff Kirsher 	QLCNIC_HW_RPMX1_CRB_AGT_ADR = 0x09,
72aa43c215SJeff Kirsher 	QLCNIC_HW_RPMX5_CRB_AGT_ADR = 0x0d,
73aa43c215SJeff Kirsher 	QLCNIC_HW_RPMX6_CRB_AGT_ADR = 0x0e,
74aa43c215SJeff Kirsher 	QLCNIC_HW_RPMX8_CRB_AGT_ADR = 0x11
75aa43c215SJeff Kirsher };
76aa43c215SJeff Kirsher 
77aa43c215SJeff Kirsher /*  Hub 3 */
78aa43c215SJeff Kirsher enum {
79aa43c215SJeff Kirsher 	QLCNIC_HW_PH_CRB_AGT_ADR = 0x1A,
80aa43c215SJeff Kirsher 	QLCNIC_HW_SRE_CRB_AGT_ADR = 0x50,
81aa43c215SJeff Kirsher 	QLCNIC_HW_EG_CRB_AGT_ADR = 0x51,
82aa43c215SJeff Kirsher 	QLCNIC_HW_RPMX0_CRB_AGT_ADR = 0x08
83aa43c215SJeff Kirsher };
84aa43c215SJeff Kirsher 
85aa43c215SJeff Kirsher /*  Hub 4 */
86aa43c215SJeff Kirsher enum {
87aa43c215SJeff Kirsher 	QLCNIC_HW_PEGN0_CRB_AGT_ADR = 0x40,
88aa43c215SJeff Kirsher 	QLCNIC_HW_PEGN1_CRB_AGT_ADR,
89aa43c215SJeff Kirsher 	QLCNIC_HW_PEGN2_CRB_AGT_ADR,
90aa43c215SJeff Kirsher 	QLCNIC_HW_PEGN3_CRB_AGT_ADR,
91aa43c215SJeff Kirsher 	QLCNIC_HW_PEGNI_CRB_AGT_ADR,
92aa43c215SJeff Kirsher 	QLCNIC_HW_PEGND_CRB_AGT_ADR,
93aa43c215SJeff Kirsher 	QLCNIC_HW_PEGNC_CRB_AGT_ADR,
94aa43c215SJeff Kirsher 	QLCNIC_HW_PEGR0_CRB_AGT_ADR,
95aa43c215SJeff Kirsher 	QLCNIC_HW_PEGR1_CRB_AGT_ADR,
96aa43c215SJeff Kirsher 	QLCNIC_HW_PEGR2_CRB_AGT_ADR,
97aa43c215SJeff Kirsher 	QLCNIC_HW_PEGR3_CRB_AGT_ADR,
98aa43c215SJeff Kirsher 	QLCNIC_HW_PEGN4_CRB_AGT_ADR
99aa43c215SJeff Kirsher };
100aa43c215SJeff Kirsher 
101aa43c215SJeff Kirsher /*  Hub 5 */
102aa43c215SJeff Kirsher enum {
103aa43c215SJeff Kirsher 	QLCNIC_HW_PEGS0_CRB_AGT_ADR = 0x40,
104aa43c215SJeff Kirsher 	QLCNIC_HW_PEGS1_CRB_AGT_ADR,
105aa43c215SJeff Kirsher 	QLCNIC_HW_PEGS2_CRB_AGT_ADR,
106aa43c215SJeff Kirsher 	QLCNIC_HW_PEGS3_CRB_AGT_ADR,
107aa43c215SJeff Kirsher 	QLCNIC_HW_PEGSI_CRB_AGT_ADR,
108aa43c215SJeff Kirsher 	QLCNIC_HW_PEGSD_CRB_AGT_ADR,
109aa43c215SJeff Kirsher 	QLCNIC_HW_PEGSC_CRB_AGT_ADR
110aa43c215SJeff Kirsher };
111aa43c215SJeff Kirsher 
112aa43c215SJeff Kirsher /*  Hub 6 */
113aa43c215SJeff Kirsher enum {
114aa43c215SJeff Kirsher 	QLCNIC_HW_CAS0_CRB_AGT_ADR = 0x46,
115aa43c215SJeff Kirsher 	QLCNIC_HW_CAS1_CRB_AGT_ADR = 0x47,
116aa43c215SJeff Kirsher 	QLCNIC_HW_CAS2_CRB_AGT_ADR = 0x48,
117aa43c215SJeff Kirsher 	QLCNIC_HW_CAS3_CRB_AGT_ADR = 0x49,
118aa43c215SJeff Kirsher 	QLCNIC_HW_NCM_CRB_AGT_ADR = 0x16,
119aa43c215SJeff Kirsher 	QLCNIC_HW_TMR_CRB_AGT_ADR = 0x17,
120aa43c215SJeff Kirsher 	QLCNIC_HW_XDMA_CRB_AGT_ADR = 0x05,
121aa43c215SJeff Kirsher 	QLCNIC_HW_OCM0_CRB_AGT_ADR = 0x06,
122aa43c215SJeff Kirsher 	QLCNIC_HW_OCM1_CRB_AGT_ADR = 0x07
123aa43c215SJeff Kirsher };
124aa43c215SJeff Kirsher 
125aa43c215SJeff Kirsher /*  Floaters - non existent modules */
126aa43c215SJeff Kirsher #define QLCNIC_HW_EFC_RPMX0_CRB_AGT_ADR	0x67
127aa43c215SJeff Kirsher 
128aa43c215SJeff Kirsher /*  This field defines PCI/X adr [25:20] of agents on the CRB */
129aa43c215SJeff Kirsher enum {
130aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PH = 0,
131aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PS,
132aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_MN,
133aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_MS,
134aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGR1,
135aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SRE,
136aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_NIU,
137aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_QMN,
138aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SQN0,
139aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SQN1,
140aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SQN2,
141aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SQN3,
142aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_QMS,
143aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SQS0,
144aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SQS1,
145aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SQS2,
146aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SQS3,
147aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGN0,
148aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGN1,
149aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGN2,
150aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGN3,
151aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGND,
152aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGNI,
153aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGS0,
154aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGS1,
155aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGS2,
156aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGS3,
157aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGSD,
158aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGSI,
159aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SN,
160aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGR2,
161aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_EG,
162aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PH2,
163aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PS2,
164aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_CAM,
165aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_CAS0,
166aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_CAS1,
167aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_CAS2,
168aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_C2C0,
169aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_C2C1,
170aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_TIMR,
171aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGR3,
172aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_RPMX1,
173aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_RPMX2,
174aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_RPMX3,
175aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_RPMX4,
176aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_RPMX5,
177aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_RPMX6,
178aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_RPMX7,
179aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_XDMA,
180aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_I2Q,
181aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_ROMUSB,
182aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_CAS3,
183aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_RPMX0,
184aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_RPMX8,
185aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_RPMX9,
186aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_OCM0,
187aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_OCM1,
188aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_SMB,
189aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_I2C0,
190aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_I2C1,
191aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_LPC,
192aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGNC,
193aa43c215SJeff Kirsher 	QLCNIC_HW_PX_MAP_CRB_PGR0
194aa43c215SJeff Kirsher };
195aa43c215SJeff Kirsher 
196aa43c215SJeff Kirsher #define	BIT_0	0x1
197aa43c215SJeff Kirsher #define	BIT_1	0x2
198aa43c215SJeff Kirsher #define	BIT_2	0x4
199aa43c215SJeff Kirsher #define	BIT_3	0x8
200aa43c215SJeff Kirsher #define	BIT_4	0x10
201aa43c215SJeff Kirsher #define	BIT_5	0x20
202aa43c215SJeff Kirsher #define	BIT_6	0x40
203aa43c215SJeff Kirsher #define	BIT_7	0x80
204aa43c215SJeff Kirsher #define	BIT_8	0x100
205aa43c215SJeff Kirsher #define	BIT_9	0x200
206aa43c215SJeff Kirsher #define	BIT_10	0x400
207aa43c215SJeff Kirsher #define	BIT_11	0x800
208aa43c215SJeff Kirsher #define	BIT_12	0x1000
209aa43c215SJeff Kirsher #define	BIT_13	0x2000
210aa43c215SJeff Kirsher #define	BIT_14	0x4000
211aa43c215SJeff Kirsher #define	BIT_15	0x8000
212aa43c215SJeff Kirsher #define	BIT_16	0x10000
213aa43c215SJeff Kirsher #define	BIT_17	0x20000
214aa43c215SJeff Kirsher #define	BIT_18	0x40000
215aa43c215SJeff Kirsher #define	BIT_19	0x80000
216aa43c215SJeff Kirsher #define	BIT_20	0x100000
217aa43c215SJeff Kirsher #define	BIT_21	0x200000
218aa43c215SJeff Kirsher #define	BIT_22	0x400000
219aa43c215SJeff Kirsher #define	BIT_23	0x800000
220aa43c215SJeff Kirsher #define	BIT_24	0x1000000
221aa43c215SJeff Kirsher #define	BIT_25	0x2000000
222aa43c215SJeff Kirsher #define	BIT_26	0x4000000
223aa43c215SJeff Kirsher #define	BIT_27	0x8000000
224aa43c215SJeff Kirsher #define	BIT_28	0x10000000
225aa43c215SJeff Kirsher #define	BIT_29	0x20000000
226aa43c215SJeff Kirsher #define	BIT_30	0x40000000
227aa43c215SJeff Kirsher #define	BIT_31	0x80000000
228aa43c215SJeff Kirsher 
229aa43c215SJeff Kirsher /*  This field defines CRB adr [31:20] of the agents */
230aa43c215SJeff Kirsher 
231aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_MN	\
232aa43c215SJeff Kirsher 	((QLCNIC_HW_H0_CH_HUB_ADR << 7) | QLCNIC_HW_MN_CRB_AGT_ADR)
233aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PH	\
234aa43c215SJeff Kirsher 	((QLCNIC_HW_H0_CH_HUB_ADR << 7) | QLCNIC_HW_PH_CRB_AGT_ADR)
235aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_MS	\
236aa43c215SJeff Kirsher 	((QLCNIC_HW_H0_CH_HUB_ADR << 7) | QLCNIC_HW_MS_CRB_AGT_ADR)
237aa43c215SJeff Kirsher 
238aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PS	\
239aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_PS_CRB_AGT_ADR)
240aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SS	\
241aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SS_CRB_AGT_ADR)
242aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX3	\
243aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX3_CRB_AGT_ADR)
244aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_QMS	\
245aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_QMS_CRB_AGT_ADR)
246aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SQS0	\
247aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SQGS0_CRB_AGT_ADR)
248aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SQS1	\
249aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SQGS1_CRB_AGT_ADR)
250aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SQS2	\
251aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SQGS2_CRB_AGT_ADR)
252aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SQS3	\
253aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SQGS3_CRB_AGT_ADR)
254aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_C2C0	\
255aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_C2C0_CRB_AGT_ADR)
256aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_C2C1	\
257aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_C2C1_CRB_AGT_ADR)
258aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX2	\
259aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX2_CRB_AGT_ADR)
260aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX4	\
261aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX4_CRB_AGT_ADR)
262aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX7	\
263aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX7_CRB_AGT_ADR)
264aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX9	\
265aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX9_CRB_AGT_ADR)
266aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SMB	\
267aa43c215SJeff Kirsher 	((QLCNIC_HW_H1_CH_HUB_ADR << 7) | QLCNIC_HW_SMB_CRB_AGT_ADR)
268aa43c215SJeff Kirsher 
269aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_NIU	\
270aa43c215SJeff Kirsher 	((QLCNIC_HW_H2_CH_HUB_ADR << 7) | QLCNIC_HW_NIU_CRB_AGT_ADR)
271aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_I2C0	\
272aa43c215SJeff Kirsher 	((QLCNIC_HW_H2_CH_HUB_ADR << 7) | QLCNIC_HW_I2C0_CRB_AGT_ADR)
273aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_I2C1	\
274aa43c215SJeff Kirsher 	((QLCNIC_HW_H2_CH_HUB_ADR << 7) | QLCNIC_HW_I2C1_CRB_AGT_ADR)
275aa43c215SJeff Kirsher 
276aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SRE	\
277aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_SRE_CRB_AGT_ADR)
278aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_EG	\
279aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_EG_CRB_AGT_ADR)
280aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX0	\
281aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX0_CRB_AGT_ADR)
282aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_QMN	\
283aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_QM_CRB_AGT_ADR)
284aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SQN0	\
285aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_SQG0_CRB_AGT_ADR)
286aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SQN1	\
287aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_SQG1_CRB_AGT_ADR)
288aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SQN2	\
289aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_SQG2_CRB_AGT_ADR)
290aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SQN3	\
291aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_SQG3_CRB_AGT_ADR)
292aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX1	\
293aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX1_CRB_AGT_ADR)
294aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX5	\
295aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX5_CRB_AGT_ADR)
296aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX6	\
297aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX6_CRB_AGT_ADR)
298aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_RPMX8	\
299aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_RPMX8_CRB_AGT_ADR)
300aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_CAS0	\
301aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_CAS0_CRB_AGT_ADR)
302aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_CAS1	\
303aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_CAS1_CRB_AGT_ADR)
304aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_CAS2	\
305aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_CAS2_CRB_AGT_ADR)
306aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_CAS3	\
307aa43c215SJeff Kirsher 	((QLCNIC_HW_H3_CH_HUB_ADR << 7) | QLCNIC_HW_CAS3_CRB_AGT_ADR)
308aa43c215SJeff Kirsher 
309aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGNI	\
310aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGNI_CRB_AGT_ADR)
311aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGND	\
312aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGND_CRB_AGT_ADR)
313aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGN0	\
314aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGN0_CRB_AGT_ADR)
315aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGN1	\
316aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGN1_CRB_AGT_ADR)
317aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGN2	\
318aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGN2_CRB_AGT_ADR)
319aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGN3	\
320aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGN3_CRB_AGT_ADR)
321aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGN4	\
322aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGN4_CRB_AGT_ADR)
323aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGNC	\
324aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGNC_CRB_AGT_ADR)
325aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGR0	\
326aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGR0_CRB_AGT_ADR)
327aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGR1	\
328aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGR1_CRB_AGT_ADR)
329aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGR2	\
330aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGR2_CRB_AGT_ADR)
331aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGR3	\
332aa43c215SJeff Kirsher 	((QLCNIC_HW_H4_CH_HUB_ADR << 7) | QLCNIC_HW_PEGR3_CRB_AGT_ADR)
333aa43c215SJeff Kirsher 
334aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGSI	\
335aa43c215SJeff Kirsher 	((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGSI_CRB_AGT_ADR)
336aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGSD	\
337aa43c215SJeff Kirsher 	((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGSD_CRB_AGT_ADR)
338aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGS0	\
339aa43c215SJeff Kirsher 	((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGS0_CRB_AGT_ADR)
340aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGS1	\
341aa43c215SJeff Kirsher 	((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGS1_CRB_AGT_ADR)
342aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGS2	\
343aa43c215SJeff Kirsher 	((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGS2_CRB_AGT_ADR)
344aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGS3	\
345aa43c215SJeff Kirsher 	((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGS3_CRB_AGT_ADR)
346aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_PGSC	\
347aa43c215SJeff Kirsher 	((QLCNIC_HW_H5_CH_HUB_ADR << 7) | QLCNIC_HW_PEGSC_CRB_AGT_ADR)
348aa43c215SJeff Kirsher 
349aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_CAM	\
350aa43c215SJeff Kirsher 	((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_NCM_CRB_AGT_ADR)
351aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_TIMR	\
352aa43c215SJeff Kirsher 	((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_TMR_CRB_AGT_ADR)
353aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_XDMA	\
354aa43c215SJeff Kirsher 	((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_XDMA_CRB_AGT_ADR)
355aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_SN	\
356aa43c215SJeff Kirsher 	((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_SN_CRB_AGT_ADR)
357aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_I2Q	\
358aa43c215SJeff Kirsher 	((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_I2Q_CRB_AGT_ADR)
359aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_ROMUSB	\
360aa43c215SJeff Kirsher 	((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_ROMUSB_CRB_AGT_ADR)
361aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_OCM0	\
362aa43c215SJeff Kirsher 	((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_OCM0_CRB_AGT_ADR)
363aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_OCM1	\
364aa43c215SJeff Kirsher 	((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_OCM1_CRB_AGT_ADR)
365aa43c215SJeff Kirsher #define QLCNIC_HW_CRB_HUB_AGT_ADR_LPC	\
366aa43c215SJeff Kirsher 	((QLCNIC_HW_H6_CH_HUB_ADR << 7) | QLCNIC_HW_LPC_CRB_AGT_ADR)
367aa43c215SJeff Kirsher 
368aa43c215SJeff Kirsher #define QLCNIC_SRE_MISC		(QLCNIC_CRB_SRE + 0x0002c)
369aa43c215SJeff Kirsher 
370aa43c215SJeff Kirsher #define QLCNIC_I2Q_CLR_PCI_HI	(QLCNIC_CRB_I2Q + 0x00034)
371aa43c215SJeff Kirsher 
372aa43c215SJeff Kirsher #define ROMUSB_GLB		(QLCNIC_CRB_ROMUSB + 0x00000)
373aa43c215SJeff Kirsher #define ROMUSB_ROM		(QLCNIC_CRB_ROMUSB + 0x10000)
374aa43c215SJeff Kirsher 
375aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_GLB_STATUS	(ROMUSB_GLB + 0x0004)
376aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_GLB_SW_RESET	(ROMUSB_GLB + 0x0008)
377aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_GLB_PAD_GPIO_I	(ROMUSB_GLB + 0x000c)
378aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_GLB_CAS_RST	(ROMUSB_GLB + 0x0038)
379aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_GLB_TEST_MUX_SEL	(ROMUSB_GLB + 0x0044)
380aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_GLB_PEGTUNE_DONE	(ROMUSB_GLB + 0x005c)
381aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_GLB_CHIP_CLK_CTRL	(ROMUSB_GLB + 0x00A8)
382aa43c215SJeff Kirsher 
383aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_GPIO(n)		(ROMUSB_GLB + 0x60 + (4 * (n)))
384aa43c215SJeff Kirsher 
385aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_ROM_INSTR_OPCODE	(ROMUSB_ROM + 0x0004)
386aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_ROM_ADDRESS	(ROMUSB_ROM + 0x0008)
387aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_ROM_WDATA		(ROMUSB_ROM + 0x000c)
388aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_ROM_ABYTE_CNT	(ROMUSB_ROM + 0x0010)
389aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT (ROMUSB_ROM + 0x0014)
390aa43c215SJeff Kirsher #define QLCNIC_ROMUSB_ROM_RDATA		(ROMUSB_ROM + 0x0018)
391aa43c215SJeff Kirsher 
392aa43c215SJeff Kirsher /* Lock IDs for ROM lock */
393aa43c215SJeff Kirsher #define ROM_LOCK_DRIVER	0x0d417340
394aa43c215SJeff Kirsher 
395aa43c215SJeff Kirsher /******************************************************************************
396aa43c215SJeff Kirsher *
397aa43c215SJeff Kirsher *    Definitions specific to M25P flash
398aa43c215SJeff Kirsher *
399aa43c215SJeff Kirsher *******************************************************************************
400aa43c215SJeff Kirsher */
401aa43c215SJeff Kirsher 
402aa43c215SJeff Kirsher /* all are 1MB windows */
403aa43c215SJeff Kirsher 
404aa43c215SJeff Kirsher #define QLCNIC_PCI_CRB_WINDOWSIZE	0x00100000
405aa43c215SJeff Kirsher #define QLCNIC_PCI_CRB_WINDOW(A)	\
406aa43c215SJeff Kirsher 	(QLCNIC_PCI_CRBSPACE + (A)*QLCNIC_PCI_CRB_WINDOWSIZE)
407aa43c215SJeff Kirsher 
408aa43c215SJeff Kirsher #define QLCNIC_CRB_NIU		QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_NIU)
409aa43c215SJeff Kirsher #define QLCNIC_CRB_SRE		QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_SRE)
410aa43c215SJeff Kirsher #define QLCNIC_CRB_ROMUSB	\
411aa43c215SJeff Kirsher 	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_ROMUSB)
41268233c58SSony Chacko #define QLCNIC_CRB_EPG		QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_EG)
413aa43c215SJeff Kirsher #define QLCNIC_CRB_I2Q		QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_I2Q)
41468233c58SSony Chacko #define QLCNIC_CRB_TIMER	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_TIMR)
415aa43c215SJeff Kirsher #define QLCNIC_CRB_I2C0 	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_I2C0)
416aa43c215SJeff Kirsher #define QLCNIC_CRB_SMB		QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_SMB)
417aa43c215SJeff Kirsher #define QLCNIC_CRB_MAX		QLCNIC_PCI_CRB_WINDOW(64)
418aa43c215SJeff Kirsher 
419aa43c215SJeff Kirsher #define QLCNIC_CRB_PCIX_HOST	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PH)
420aa43c215SJeff Kirsher #define QLCNIC_CRB_PCIX_HOST2	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PH2)
421aa43c215SJeff Kirsher #define QLCNIC_CRB_PEG_NET_0	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGN0)
422aa43c215SJeff Kirsher #define QLCNIC_CRB_PEG_NET_1	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGN1)
423aa43c215SJeff Kirsher #define QLCNIC_CRB_PEG_NET_2	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGN2)
424aa43c215SJeff Kirsher #define QLCNIC_CRB_PEG_NET_3	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGN3)
425aa43c215SJeff Kirsher #define QLCNIC_CRB_PEG_NET_4	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_SQS2)
426aa43c215SJeff Kirsher #define QLCNIC_CRB_PEG_NET_D	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGND)
427aa43c215SJeff Kirsher #define QLCNIC_CRB_PEG_NET_I	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PGNI)
428aa43c215SJeff Kirsher #define QLCNIC_CRB_DDR_NET	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_MN)
429aa43c215SJeff Kirsher #define QLCNIC_CRB_QDR_NET	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_SN)
430aa43c215SJeff Kirsher 
431aa43c215SJeff Kirsher #define QLCNIC_CRB_PCIX_MD	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_PS)
432aa43c215SJeff Kirsher #define QLCNIC_CRB_PCIE 	QLCNIC_CRB_PCIX_MD
433aa43c215SJeff Kirsher 
434aa43c215SJeff Kirsher #define ISR_INT_VECTOR		(QLCNIC_PCIX_PS_REG(PCIX_INT_VECTOR))
435aa43c215SJeff Kirsher #define ISR_INT_MASK		(QLCNIC_PCIX_PS_REG(PCIX_INT_MASK))
436aa43c215SJeff Kirsher #define ISR_INT_MASK_SLOW	(QLCNIC_PCIX_PS_REG(PCIX_INT_MASK))
437aa43c215SJeff Kirsher #define ISR_INT_TARGET_STATUS	(QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS))
438aa43c215SJeff Kirsher #define ISR_INT_TARGET_MASK	(QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK))
439aa43c215SJeff Kirsher #define ISR_INT_TARGET_STATUS_F1   (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F1))
440aa43c215SJeff Kirsher #define ISR_INT_TARGET_MASK_F1     (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F1))
441aa43c215SJeff Kirsher #define ISR_INT_TARGET_STATUS_F2   (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F2))
442aa43c215SJeff Kirsher #define ISR_INT_TARGET_MASK_F2     (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F2))
443aa43c215SJeff Kirsher #define ISR_INT_TARGET_STATUS_F3   (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F3))
444aa43c215SJeff Kirsher #define ISR_INT_TARGET_MASK_F3     (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F3))
445aa43c215SJeff Kirsher #define ISR_INT_TARGET_STATUS_F4   (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F4))
446aa43c215SJeff Kirsher #define ISR_INT_TARGET_MASK_F4     (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F4))
447aa43c215SJeff Kirsher #define ISR_INT_TARGET_STATUS_F5   (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F5))
448aa43c215SJeff Kirsher #define ISR_INT_TARGET_MASK_F5     (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F5))
449aa43c215SJeff Kirsher #define ISR_INT_TARGET_STATUS_F6   (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F6))
450aa43c215SJeff Kirsher #define ISR_INT_TARGET_MASK_F6     (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F6))
451aa43c215SJeff Kirsher #define ISR_INT_TARGET_STATUS_F7   (QLCNIC_PCIX_PS_REG(PCIX_TARGET_STATUS_F7))
452aa43c215SJeff Kirsher #define ISR_INT_TARGET_MASK_F7     (QLCNIC_PCIX_PS_REG(PCIX_TARGET_MASK_F7))
453aa43c215SJeff Kirsher 
454aa43c215SJeff Kirsher #define QLCNIC_PCI_MN_2M	(0)
455aa43c215SJeff Kirsher #define QLCNIC_PCI_MS_2M	(0x80000)
456aa43c215SJeff Kirsher #define QLCNIC_PCI_OCM0_2M	(0x000c0000UL)
457aa43c215SJeff Kirsher #define QLCNIC_PCI_CRBSPACE	(0x06000000UL)
458aa43c215SJeff Kirsher #define QLCNIC_PCI_CAMQM	(0x04800000UL)
459aa43c215SJeff Kirsher #define QLCNIC_PCI_CAMQM_END	(0x04800800UL)
460aa43c215SJeff Kirsher #define QLCNIC_PCI_2MB_SIZE	(0x00200000UL)
461aa43c215SJeff Kirsher #define QLCNIC_PCI_CAMQM_2M_BASE	(0x000ff800UL)
462aa43c215SJeff Kirsher 
463aa43c215SJeff Kirsher #define QLCNIC_CRB_CAM	QLCNIC_PCI_CRB_WINDOW(QLCNIC_HW_PX_MAP_CRB_CAM)
464aa43c215SJeff Kirsher 
465aa43c215SJeff Kirsher #define QLCNIC_ADDR_DDR_NET	(0x0000000000000000ULL)
466aa43c215SJeff Kirsher #define QLCNIC_ADDR_DDR_NET_MAX (0x000000000fffffffULL)
467aa43c215SJeff Kirsher #define QLCNIC_ADDR_OCM0	(0x0000000200000000ULL)
468aa43c215SJeff Kirsher #define QLCNIC_ADDR_OCM0_MAX	(0x00000002000fffffULL)
469aa43c215SJeff Kirsher #define QLCNIC_ADDR_OCM1	(0x0000000200400000ULL)
470aa43c215SJeff Kirsher #define QLCNIC_ADDR_OCM1_MAX	(0x00000002004fffffULL)
471aa43c215SJeff Kirsher #define QLCNIC_ADDR_QDR_NET	(0x0000000300000000ULL)
472aa43c215SJeff Kirsher #define QLCNIC_ADDR_QDR_NET_MAX (0x0000000307ffffffULL)
473aa43c215SJeff Kirsher 
474aa43c215SJeff Kirsher /*
475aa43c215SJeff Kirsher  *   Register offsets for MN
476aa43c215SJeff Kirsher  */
477aa43c215SJeff Kirsher #define QLCNIC_MIU_CONTROL	(0x000)
478aa43c215SJeff Kirsher #define QLCNIC_MIU_MN_CONTROL	(QLCNIC_CRB_DDR_NET+QLCNIC_MIU_CONTROL)
479aa43c215SJeff Kirsher 
480aa43c215SJeff Kirsher /* 200ms delay in each loop */
481aa43c215SJeff Kirsher #define QLCNIC_NIU_PHY_WAITLEN		200000
482aa43c215SJeff Kirsher /* 10 seconds before we give up */
483aa43c215SJeff Kirsher #define QLCNIC_NIU_PHY_WAITMAX		50
484aa43c215SJeff Kirsher #define QLCNIC_NIU_MAX_GBE_PORTS	4
485aa43c215SJeff Kirsher #define QLCNIC_NIU_MAX_XG_PORTS		2
486aa43c215SJeff Kirsher 
487aa43c215SJeff Kirsher #define QLCNIC_NIU_MODE			(QLCNIC_CRB_NIU + 0x00000)
488aa43c215SJeff Kirsher #define QLCNIC_NIU_GB_PAUSE_CTL		(QLCNIC_CRB_NIU + 0x0030c)
489aa43c215SJeff Kirsher #define QLCNIC_NIU_XG_PAUSE_CTL		(QLCNIC_CRB_NIU + 0x00098)
490aa43c215SJeff Kirsher 
491aa43c215SJeff Kirsher #define QLCNIC_NIU_GB_MAC_CONFIG_0(I)		\
492aa43c215SJeff Kirsher 		(QLCNIC_CRB_NIU + 0x30000 + (I)*0x10000)
493aa43c215SJeff Kirsher #define QLCNIC_NIU_GB_MAC_CONFIG_1(I)		\
494aa43c215SJeff Kirsher 		(QLCNIC_CRB_NIU + 0x30004 + (I)*0x10000)
495aa43c215SJeff Kirsher 
496*7f966452SSony Chacko #define MAX_CTL_CHECK	1000
497aa43c215SJeff Kirsher #define TEST_AGT_CTRL	(0x00)
498aa43c215SJeff Kirsher 
499aa43c215SJeff Kirsher #define TA_CTL_START	BIT_0
500aa43c215SJeff Kirsher #define TA_CTL_ENABLE	BIT_1
501aa43c215SJeff Kirsher #define TA_CTL_WRITE	BIT_2
502aa43c215SJeff Kirsher #define TA_CTL_BUSY	BIT_3
503aa43c215SJeff Kirsher 
504aa43c215SJeff Kirsher /*
505aa43c215SJeff Kirsher  *   Register offsets for MN
506aa43c215SJeff Kirsher  */
507aa43c215SJeff Kirsher #define MIU_TEST_AGT_BASE		(0x90)
508aa43c215SJeff Kirsher 
509aa43c215SJeff Kirsher #define MIU_TEST_AGT_ADDR_LO		(0x04)
510aa43c215SJeff Kirsher #define MIU_TEST_AGT_ADDR_HI		(0x08)
511aa43c215SJeff Kirsher #define MIU_TEST_AGT_WRDATA_LO		(0x10)
512aa43c215SJeff Kirsher #define MIU_TEST_AGT_WRDATA_HI		(0x14)
513aa43c215SJeff Kirsher #define MIU_TEST_AGT_WRDATA_UPPER_LO	(0x20)
514aa43c215SJeff Kirsher #define MIU_TEST_AGT_WRDATA_UPPER_HI	(0x24)
515aa43c215SJeff Kirsher #define MIU_TEST_AGT_WRDATA(i)		(0x10+(0x10*((i)>>1))+(4*((i)&1)))
516aa43c215SJeff Kirsher #define MIU_TEST_AGT_RDDATA_LO		(0x18)
517aa43c215SJeff Kirsher #define MIU_TEST_AGT_RDDATA_HI		(0x1c)
518aa43c215SJeff Kirsher #define MIU_TEST_AGT_RDDATA_UPPER_LO	(0x28)
519aa43c215SJeff Kirsher #define MIU_TEST_AGT_RDDATA_UPPER_HI	(0x2c)
520aa43c215SJeff Kirsher #define MIU_TEST_AGT_RDDATA(i)		(0x18+(0x10*((i)>>1))+(4*((i)&1)))
521aa43c215SJeff Kirsher 
522aa43c215SJeff Kirsher #define MIU_TEST_AGT_ADDR_MASK		0xfffffff8
523aa43c215SJeff Kirsher #define MIU_TEST_AGT_UPPER_ADDR(off)	(0)
524aa43c215SJeff Kirsher 
525aa43c215SJeff Kirsher /*
526aa43c215SJeff Kirsher  *   Register offsets for MS
527aa43c215SJeff Kirsher  */
528aa43c215SJeff Kirsher #define SIU_TEST_AGT_BASE		(0x60)
529aa43c215SJeff Kirsher 
530aa43c215SJeff Kirsher #define SIU_TEST_AGT_ADDR_LO		(0x04)
531aa43c215SJeff Kirsher #define SIU_TEST_AGT_ADDR_HI		(0x18)
532aa43c215SJeff Kirsher #define SIU_TEST_AGT_WRDATA_LO		(0x08)
533aa43c215SJeff Kirsher #define SIU_TEST_AGT_WRDATA_HI		(0x0c)
534aa43c215SJeff Kirsher #define SIU_TEST_AGT_WRDATA(i)		(0x08+(4*(i)))
535aa43c215SJeff Kirsher #define SIU_TEST_AGT_RDDATA_LO		(0x10)
536aa43c215SJeff Kirsher #define SIU_TEST_AGT_RDDATA_HI		(0x14)
537aa43c215SJeff Kirsher #define SIU_TEST_AGT_RDDATA(i)		(0x10+(4*(i)))
538aa43c215SJeff Kirsher 
539aa43c215SJeff Kirsher #define SIU_TEST_AGT_ADDR_MASK		0x3ffff8
540aa43c215SJeff Kirsher #define SIU_TEST_AGT_UPPER_ADDR(off)	((off)>>22)
541aa43c215SJeff Kirsher 
542aa43c215SJeff Kirsher /* XG Link status */
543aa43c215SJeff Kirsher #define XG_LINK_UP	0x10
544aa43c215SJeff Kirsher #define XG_LINK_DOWN	0x20
545aa43c215SJeff Kirsher 
546aa43c215SJeff Kirsher #define XG_LINK_UP_P3P	0x01
547aa43c215SJeff Kirsher #define XG_LINK_DOWN_P3P	0x02
548aa43c215SJeff Kirsher #define XG_LINK_STATE_P3P_MASK 0xf
549aa43c215SJeff Kirsher #define XG_LINK_STATE_P3P(pcifn, val) \
550aa43c215SJeff Kirsher 	(((val) >> ((pcifn) * 4)) & XG_LINK_STATE_P3P_MASK)
551aa43c215SJeff Kirsher 
552aa43c215SJeff Kirsher #define P3P_LINK_SPEED_MHZ	100
553aa43c215SJeff Kirsher #define P3P_LINK_SPEED_MASK	0xff
554aa43c215SJeff Kirsher #define P3P_LINK_SPEED_REG(pcifn)	\
555aa43c215SJeff Kirsher 	(CRB_PF_LINK_SPEED_1 + (((pcifn) / 4) * 4))
556aa43c215SJeff Kirsher #define P3P_LINK_SPEED_VAL(pcifn, reg)	\
557aa43c215SJeff Kirsher 	(((reg) >> (8 * ((pcifn) & 0x3))) & P3P_LINK_SPEED_MASK)
558aa43c215SJeff Kirsher 
559aa43c215SJeff Kirsher #define QLCNIC_CAM_RAM_BASE	(QLCNIC_CRB_CAM + 0x02000)
560aa43c215SJeff Kirsher #define QLCNIC_CAM_RAM(reg)	(QLCNIC_CAM_RAM_BASE + (reg))
561aa43c215SJeff Kirsher #define QLCNIC_FW_VERSION_MAJOR (QLCNIC_CAM_RAM(0x150))
562aa43c215SJeff Kirsher #define QLCNIC_FW_VERSION_MINOR (QLCNIC_CAM_RAM(0x154))
563aa43c215SJeff Kirsher #define QLCNIC_FW_VERSION_SUB	(QLCNIC_CAM_RAM(0x158))
564aa43c215SJeff Kirsher #define QLCNIC_ROM_LOCK_ID	(QLCNIC_CAM_RAM(0x100))
565aa43c215SJeff Kirsher #define QLCNIC_PHY_LOCK_ID	(QLCNIC_CAM_RAM(0x120))
566aa43c215SJeff Kirsher #define QLCNIC_CRB_WIN_LOCK_ID	(QLCNIC_CAM_RAM(0x124))
567aa43c215SJeff Kirsher 
568aa43c215SJeff Kirsher #define NIC_CRB_BASE		(QLCNIC_CAM_RAM(0x200))
569aa43c215SJeff Kirsher #define NIC_CRB_BASE_2		(QLCNIC_CAM_RAM(0x700))
570aa43c215SJeff Kirsher #define QLCNIC_REG(X)		(NIC_CRB_BASE+(X))
571aa43c215SJeff Kirsher #define QLCNIC_REG_2(X) 	(NIC_CRB_BASE_2+(X))
572aa43c215SJeff Kirsher 
5737e2cf4feSSony Chacko #define QLCNIC_CDRP_MAX_ARGS	4
5747e2cf4feSSony Chacko #define QLCNIC_CDRP_ARG(i)	(QLCNIC_REG(0x18 + ((i) * 4)))
5757e2cf4feSSony Chacko 
576aa43c215SJeff Kirsher #define QLCNIC_CDRP_CRB_OFFSET		(QLCNIC_REG(0x18))
577aa43c215SJeff Kirsher #define QLCNIC_ARG1_CRB_OFFSET		(QLCNIC_REG(0x1c))
578aa43c215SJeff Kirsher #define QLCNIC_ARG2_CRB_OFFSET		(QLCNIC_REG(0x20))
579aa43c215SJeff Kirsher #define QLCNIC_ARG3_CRB_OFFSET		(QLCNIC_REG(0x24))
580aa43c215SJeff Kirsher #define QLCNIC_SIGN_CRB_OFFSET		(QLCNIC_REG(0x28))
581aa43c215SJeff Kirsher 
582aa43c215SJeff Kirsher #define CRB_CMDPEG_STATE		(QLCNIC_REG(0x50))
583aa43c215SJeff Kirsher #define CRB_RCVPEG_STATE		(QLCNIC_REG(0x13c))
584aa43c215SJeff Kirsher 
585aa43c215SJeff Kirsher #define CRB_XG_STATE_P3P		(QLCNIC_REG(0x98))
586aa43c215SJeff Kirsher #define CRB_PF_LINK_SPEED_1		(QLCNIC_REG(0xe8))
587aa43c215SJeff Kirsher #define CRB_PF_LINK_SPEED_2		(QLCNIC_REG(0xec))
588aa43c215SJeff Kirsher 
589aa43c215SJeff Kirsher #define CRB_TEMP_STATE			(QLCNIC_REG(0x1b4))
590aa43c215SJeff Kirsher 
591aa43c215SJeff Kirsher #define CRB_V2P_0			(QLCNIC_REG(0x290))
592aa43c215SJeff Kirsher #define CRB_V2P(port)			(CRB_V2P_0+((port)*4))
593aa43c215SJeff Kirsher #define CRB_DRIVER_VERSION		(QLCNIC_REG(0x2a0))
594aa43c215SJeff Kirsher 
595aa43c215SJeff Kirsher #define CRB_FW_CAPABILITIES_1		(QLCNIC_CAM_RAM(0x128))
596cae82d49SRajesh Borundia #define CRB_FW_CAPABILITIES_2		(QLCNIC_CAM_RAM(0x12c))
597aa43c215SJeff Kirsher #define CRB_MAC_BLOCK_START		(QLCNIC_CAM_RAM(0x1c0))
598aa43c215SJeff Kirsher 
599aa43c215SJeff Kirsher /*
600aa43c215SJeff Kirsher  * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address
601aa43c215SJeff Kirsher  * which can be read by the Phantom host to get producer/consumer indexes from
602aa43c215SJeff Kirsher  * Phantom/Casper. If it is not HOST_SHARED_MEMORY, then the following
603aa43c215SJeff Kirsher  * registers will be used for the addresses of the ring's shared memory
604aa43c215SJeff Kirsher  * on the Phantom.
605aa43c215SJeff Kirsher  */
606aa43c215SJeff Kirsher 
607aa43c215SJeff Kirsher #define qlcnic_get_temp_val(x)		((x) >> 16)
608aa43c215SJeff Kirsher #define qlcnic_get_temp_state(x)	((x) & 0xffff)
609aa43c215SJeff Kirsher #define qlcnic_encode_temp(val, state)	(((val) << 16) | (state))
610aa43c215SJeff Kirsher 
611aa43c215SJeff Kirsher /*
612aa43c215SJeff Kirsher  * Temperature control.
613aa43c215SJeff Kirsher  */
614aa43c215SJeff Kirsher enum {
615aa43c215SJeff Kirsher 	QLCNIC_TEMP_NORMAL = 0x1,	/* Normal operating range */
616aa43c215SJeff Kirsher 	QLCNIC_TEMP_WARN,	/* Sound alert, temperature getting high */
617aa43c215SJeff Kirsher 	QLCNIC_TEMP_PANIC	/* Fatal error, hardware has shut down. */
618aa43c215SJeff Kirsher };
619aa43c215SJeff Kirsher 
62044f65b29SSony Chacko 
621aa43c215SJeff Kirsher /* Lock IDs for PHY lock */
622aa43c215SJeff Kirsher #define PHY_LOCK_DRIVER		0x44524956
623aa43c215SJeff Kirsher 
624aa43c215SJeff Kirsher /* Used for PS PCI Memory access */
625aa43c215SJeff Kirsher #define PCIX_PS_OP_ADDR_LO	(0x10000)
626aa43c215SJeff Kirsher /*   via CRB  (PS side only)     */
627aa43c215SJeff Kirsher #define PCIX_PS_OP_ADDR_HI	(0x10004)
628aa43c215SJeff Kirsher 
629aa43c215SJeff Kirsher #define PCIX_INT_VECTOR 	(0x10100)
630aa43c215SJeff Kirsher #define PCIX_INT_MASK		(0x10104)
631aa43c215SJeff Kirsher 
632aa43c215SJeff Kirsher #define PCIX_OCM_WINDOW		(0x10800)
633aa43c215SJeff Kirsher #define PCIX_OCM_WINDOW_REG(func)	(PCIX_OCM_WINDOW + 0x4 * (func))
634aa43c215SJeff Kirsher 
635aa43c215SJeff Kirsher #define PCIX_TARGET_STATUS	(0x10118)
636aa43c215SJeff Kirsher #define PCIX_TARGET_STATUS_F1	(0x10160)
637aa43c215SJeff Kirsher #define PCIX_TARGET_STATUS_F2	(0x10164)
638aa43c215SJeff Kirsher #define PCIX_TARGET_STATUS_F3	(0x10168)
639aa43c215SJeff Kirsher #define PCIX_TARGET_STATUS_F4	(0x10360)
640aa43c215SJeff Kirsher #define PCIX_TARGET_STATUS_F5	(0x10364)
641aa43c215SJeff Kirsher #define PCIX_TARGET_STATUS_F6	(0x10368)
642aa43c215SJeff Kirsher #define PCIX_TARGET_STATUS_F7	(0x1036c)
643aa43c215SJeff Kirsher 
644aa43c215SJeff Kirsher #define PCIX_TARGET_MASK	(0x10128)
645aa43c215SJeff Kirsher #define PCIX_TARGET_MASK_F1	(0x10170)
646aa43c215SJeff Kirsher #define PCIX_TARGET_MASK_F2	(0x10174)
647aa43c215SJeff Kirsher #define PCIX_TARGET_MASK_F3	(0x10178)
648aa43c215SJeff Kirsher #define PCIX_TARGET_MASK_F4	(0x10370)
649aa43c215SJeff Kirsher #define PCIX_TARGET_MASK_F5	(0x10374)
650aa43c215SJeff Kirsher #define PCIX_TARGET_MASK_F6	(0x10378)
651aa43c215SJeff Kirsher #define PCIX_TARGET_MASK_F7	(0x1037c)
652aa43c215SJeff Kirsher 
653aa43c215SJeff Kirsher #define PCIX_MSI_F(i)		(0x13000+((i)*4))
654aa43c215SJeff Kirsher 
655aa43c215SJeff Kirsher #define QLCNIC_PCIX_PH_REG(reg)	(QLCNIC_CRB_PCIE + (reg))
656aa43c215SJeff Kirsher #define QLCNIC_PCIX_PS_REG(reg)	(QLCNIC_CRB_PCIX_MD + (reg))
657aa43c215SJeff Kirsher #define QLCNIC_PCIE_REG(reg)	(QLCNIC_CRB_PCIE + (reg))
658aa43c215SJeff Kirsher 
659aa43c215SJeff Kirsher #define PCIE_SEM0_LOCK		(0x1c000)
660aa43c215SJeff Kirsher #define PCIE_SEM0_UNLOCK	(0x1c004)
661aa43c215SJeff Kirsher #define PCIE_SEM_LOCK(N)	(PCIE_SEM0_LOCK + 8*(N))
662aa43c215SJeff Kirsher #define PCIE_SEM_UNLOCK(N)	(PCIE_SEM0_UNLOCK + 8*(N))
663aa43c215SJeff Kirsher 
664aa43c215SJeff Kirsher #define PCIE_SETUP_FUNCTION	(0x12040)
665aa43c215SJeff Kirsher #define PCIE_SETUP_FUNCTION2	(0x12048)
666aa43c215SJeff Kirsher #define PCIE_MISCCFG_RC         (0x1206c)
667aa43c215SJeff Kirsher #define PCIE_TGT_SPLIT_CHICKEN	(0x12080)
668aa43c215SJeff Kirsher #define PCIE_CHICKEN3		(0x120c8)
669aa43c215SJeff Kirsher 
670aa43c215SJeff Kirsher #define ISR_INT_STATE_REG       (QLCNIC_PCIX_PS_REG(PCIE_MISCCFG_RC))
671aa43c215SJeff Kirsher #define PCIE_MAX_MASTER_SPLIT	(0x14048)
672aa43c215SJeff Kirsher 
673aa43c215SJeff Kirsher #define QLCNIC_PORT_MODE_NONE		0
674aa43c215SJeff Kirsher #define QLCNIC_PORT_MODE_XG		1
675aa43c215SJeff Kirsher #define QLCNIC_PORT_MODE_GB		2
676aa43c215SJeff Kirsher #define QLCNIC_PORT_MODE_802_3_AP	3
677aa43c215SJeff Kirsher #define QLCNIC_PORT_MODE_AUTO_NEG	4
678aa43c215SJeff Kirsher #define QLCNIC_PORT_MODE_AUTO_NEG_1G	5
679aa43c215SJeff Kirsher #define QLCNIC_PORT_MODE_AUTO_NEG_XG	6
680aa43c215SJeff Kirsher #define QLCNIC_PORT_MODE_ADDR		(QLCNIC_CAM_RAM(0x24))
681aa43c215SJeff Kirsher #define QLCNIC_WOL_PORT_MODE		(QLCNIC_CAM_RAM(0x198))
682aa43c215SJeff Kirsher 
683aa43c215SJeff Kirsher #define QLCNIC_WOL_CONFIG_NV		(QLCNIC_CAM_RAM(0x184))
684aa43c215SJeff Kirsher #define QLCNIC_WOL_CONFIG		(QLCNIC_CAM_RAM(0x188))
685aa43c215SJeff Kirsher 
686aa43c215SJeff Kirsher #define QLCNIC_PEG_TUNE_MN_PRESENT	0x1
687aa43c215SJeff Kirsher #define QLCNIC_PEG_TUNE_CAPABILITY	(QLCNIC_CAM_RAM(0x02c))
688aa43c215SJeff Kirsher 
689aa43c215SJeff Kirsher #define QLCNIC_DMA_WATCHDOG_CTRL	(QLCNIC_CAM_RAM(0x14))
690aa43c215SJeff Kirsher #define QLCNIC_PEG_ALIVE_COUNTER	(QLCNIC_CAM_RAM(0xb0))
691aa43c215SJeff Kirsher #define QLCNIC_PEG_HALT_STATUS1 	(QLCNIC_CAM_RAM(0xa8))
692aa43c215SJeff Kirsher #define QLCNIC_PEG_HALT_STATUS2 	(QLCNIC_CAM_RAM(0xac))
693aa43c215SJeff Kirsher #define QLCNIC_CRB_DRV_ACTIVE	(QLCNIC_CAM_RAM(0x138))
694aa43c215SJeff Kirsher #define QLCNIC_CRB_DEV_STATE		(QLCNIC_CAM_RAM(0x140))
695aa43c215SJeff Kirsher 
696aa43c215SJeff Kirsher #define QLCNIC_CRB_DRV_STATE		(QLCNIC_CAM_RAM(0x144))
697aa43c215SJeff Kirsher #define QLCNIC_CRB_DRV_SCRATCH		(QLCNIC_CAM_RAM(0x148))
698aa43c215SJeff Kirsher #define QLCNIC_CRB_DEV_PARTITION_INFO	(QLCNIC_CAM_RAM(0x14c))
699aa43c215SJeff Kirsher #define QLCNIC_CRB_DRV_IDC_VER		(QLCNIC_CAM_RAM(0x174))
700aa43c215SJeff Kirsher #define QLCNIC_CRB_DEV_NPAR_STATE	(QLCNIC_CAM_RAM(0x19c))
701aa43c215SJeff Kirsher #define QLCNIC_ROM_DEV_INIT_TIMEOUT	(0x3e885c)
702aa43c215SJeff Kirsher #define QLCNIC_ROM_DRV_RESET_TIMEOUT	(0x3e8860)
703aa43c215SJeff Kirsher 
704aa43c215SJeff Kirsher /* Device State */
705aa43c215SJeff Kirsher #define QLCNIC_DEV_COLD			0x1
706aa43c215SJeff Kirsher #define QLCNIC_DEV_INITIALIZING		0x2
707aa43c215SJeff Kirsher #define QLCNIC_DEV_READY		0x3
708aa43c215SJeff Kirsher #define QLCNIC_DEV_NEED_RESET		0x4
709aa43c215SJeff Kirsher #define QLCNIC_DEV_NEED_QUISCENT	0x5
710aa43c215SJeff Kirsher #define QLCNIC_DEV_FAILED		0x6
711aa43c215SJeff Kirsher #define QLCNIC_DEV_QUISCENT		0x7
712aa43c215SJeff Kirsher 
713b43e5ee7SSucheta Chakraborty #define QLCNIC_DEV_BADBAD		0xbad0bad0
714b43e5ee7SSucheta Chakraborty 
715aa43c215SJeff Kirsher #define QLCNIC_DEV_NPAR_NON_OPER	0 /* NON Operational */
716aa43c215SJeff Kirsher #define QLCNIC_DEV_NPAR_OPER		1 /* NPAR Operational */
717aa43c215SJeff Kirsher #define QLCNIC_DEV_NPAR_OPER_TIMEO	30 /* Operational time out */
718aa43c215SJeff Kirsher 
719aa43c215SJeff Kirsher #define QLC_DEV_CHECK_ACTIVE(VAL, FN)		((VAL) & (1 << (FN * 4)))
720aa43c215SJeff Kirsher #define QLC_DEV_SET_REF_CNT(VAL, FN)		((VAL) |= (1 << (FN * 4)))
721aa43c215SJeff Kirsher #define QLC_DEV_CLR_REF_CNT(VAL, FN)		((VAL) &= ~(1 << (FN * 4)))
722aa43c215SJeff Kirsher #define QLC_DEV_SET_RST_RDY(VAL, FN)		((VAL) |= (1 << (FN * 4)))
723aa43c215SJeff Kirsher #define QLC_DEV_SET_QSCNT_RDY(VAL, FN)		((VAL) |= (2 << (FN * 4)))
724aa43c215SJeff Kirsher #define QLC_DEV_CLR_RST_QSCNT(VAL, FN)		((VAL) &= ~(3 << (FN * 4)))
725aa43c215SJeff Kirsher 
726aa43c215SJeff Kirsher #define QLC_DEV_GET_DRV(VAL, FN)		(0xf & ((VAL) >> (FN * 4)))
727aa43c215SJeff Kirsher #define QLC_DEV_SET_DRV(VAL, FN)		((VAL) << (FN * 4))
728aa43c215SJeff Kirsher 
729aa43c215SJeff Kirsher #define QLCNIC_TYPE_NIC		1
730aa43c215SJeff Kirsher #define QLCNIC_TYPE_FCOE		2
731aa43c215SJeff Kirsher #define QLCNIC_TYPE_ISCSI		3
732aa43c215SJeff Kirsher 
733aa43c215SJeff Kirsher #define QLCNIC_RCODE_DRIVER_INFO		0x20000000
734aa43c215SJeff Kirsher #define QLCNIC_RCODE_DRIVER_CAN_RELOAD		BIT_30
735aa43c215SJeff Kirsher #define QLCNIC_RCODE_FATAL_ERROR		BIT_31
736aa43c215SJeff Kirsher #define QLCNIC_FWERROR_PEGNUM(code)		((code) & 0xff)
73744f65b29SSony Chacko #define QLCNIC_FWERROR_CODE(code)		((code >> 8) & 0x1fffff)
73844f65b29SSony Chacko #define QLCNIC_FWERROR_FAN_FAILURE		0x16
739aa43c215SJeff Kirsher 
740aa43c215SJeff Kirsher #define FW_POLL_DELAY		(1 * HZ)
741aa43c215SJeff Kirsher #define FW_FAIL_THRESH		2
742aa43c215SJeff Kirsher 
743aa43c215SJeff Kirsher #define QLCNIC_RESET_TIMEOUT_SECS	10
744aa43c215SJeff Kirsher #define QLCNIC_INIT_TIMEOUT_SECS	30
745aa43c215SJeff Kirsher #define QLCNIC_RCVPEG_CHECK_RETRY_COUNT	2000
746aa43c215SJeff Kirsher #define QLCNIC_RCVPEG_CHECK_DELAY	10
747aa43c215SJeff Kirsher #define QLCNIC_CMDPEG_CHECK_RETRY_COUNT	60
748aa43c215SJeff Kirsher #define QLCNIC_CMDPEG_CHECK_DELAY	500
749aa43c215SJeff Kirsher #define QLCNIC_HEARTBEAT_PERIOD_MSECS	200
750aa43c215SJeff Kirsher #define QLCNIC_HEARTBEAT_CHECK_RETRY_COUNT	45
751aa43c215SJeff Kirsher 
752*7f966452SSony Chacko #define QLCNIC_MAX_MC_COUNT		38
753*7f966452SSony Chacko #define QLCNIC_WATCHDOG_TIMEOUTVALUE	5
754*7f966452SSony Chacko 
755aa43c215SJeff Kirsher #define	ISR_MSI_INT_TRIGGER(FUNC) (QLCNIC_PCIX_PS_REG(PCIX_MSI_F(FUNC)))
756aa43c215SJeff Kirsher #define ISR_LEGACY_INT_TRIGGERED(VAL)	(((VAL) & 0x300) == 0x200)
757aa43c215SJeff Kirsher 
758aa43c215SJeff Kirsher /*
759aa43c215SJeff Kirsher  * PCI Interrupt Vector Values.
760aa43c215SJeff Kirsher  */
761aa43c215SJeff Kirsher #define	PCIX_INT_VECTOR_BIT_F0	0x0080
762aa43c215SJeff Kirsher #define	PCIX_INT_VECTOR_BIT_F1	0x0100
763aa43c215SJeff Kirsher #define	PCIX_INT_VECTOR_BIT_F2	0x0200
764aa43c215SJeff Kirsher #define	PCIX_INT_VECTOR_BIT_F3	0x0400
765aa43c215SJeff Kirsher #define	PCIX_INT_VECTOR_BIT_F4	0x0800
766aa43c215SJeff Kirsher #define	PCIX_INT_VECTOR_BIT_F5	0x1000
767aa43c215SJeff Kirsher #define	PCIX_INT_VECTOR_BIT_F6	0x2000
768aa43c215SJeff Kirsher #define	PCIX_INT_VECTOR_BIT_F7	0x4000
769aa43c215SJeff Kirsher 
770aa43c215SJeff Kirsher struct qlcnic_legacy_intr_set {
771aa43c215SJeff Kirsher 	u32	int_vec_bit;
772aa43c215SJeff Kirsher 	u32	tgt_status_reg;
773aa43c215SJeff Kirsher 	u32	tgt_mask_reg;
774aa43c215SJeff Kirsher 	u32	pci_int_reg;
775aa43c215SJeff Kirsher };
776aa43c215SJeff Kirsher 
777aa43c215SJeff Kirsher #define QLCNIC_FW_API		0x1b216c
778aa43c215SJeff Kirsher #define QLCNIC_DRV_OP_MODE	0x1b2170
779aa43c215SJeff Kirsher #define QLCNIC_MSIX_BASE	0x132110
780aa43c215SJeff Kirsher #define QLCNIC_MAX_PCI_FUNC	8
781aa43c215SJeff Kirsher #define QLCNIC_MAX_VLAN_FILTERS	64
782aa43c215SJeff Kirsher 
783aa43c215SJeff Kirsher /* FW dump defines */
784aa43c215SJeff Kirsher #define MIU_TEST_CTR		0x41000090
785aa43c215SJeff Kirsher #define MIU_TEST_ADDR_LO	0x41000094
786aa43c215SJeff Kirsher #define MIU_TEST_ADDR_HI	0x41000098
787aa43c215SJeff Kirsher #define FLASH_ROM_WINDOW	0x42110030
788aa43c215SJeff Kirsher #define FLASH_ROM_DATA		0x42150000
789aa43c215SJeff Kirsher 
7904fbec4d8SManish Chopra 
7914fbec4d8SManish Chopra static const u32 FW_DUMP_LEVELS[] = {
7924fbec4d8SManish Chopra 	0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff };
7934fbec4d8SManish Chopra 
794aa43c215SJeff Kirsher static const u32 MIU_TEST_READ_DATA[] = {
795aa43c215SJeff Kirsher 	0x410000A8, 0x410000AC, 0x410000B8, 0x410000BC, };
796aa43c215SJeff Kirsher 
797aa43c215SJeff Kirsher #define QLCNIC_FW_DUMP_REG1	0x00130060
798aa43c215SJeff Kirsher #define QLCNIC_FW_DUMP_REG2	0x001e0000
799aa43c215SJeff Kirsher #define QLCNIC_FLASH_SEM2_LK	0x0013C010
800aa43c215SJeff Kirsher #define QLCNIC_FLASH_SEM2_ULK	0x0013C014
801aa43c215SJeff Kirsher #define QLCNIC_FLASH_LOCK_ID	0x001B2100
802aa43c215SJeff Kirsher 
803aa43c215SJeff Kirsher /* PCI function operational mode */
804aa43c215SJeff Kirsher enum {
805aa43c215SJeff Kirsher 	QLCNIC_MGMT_FUNC	= 0,
806aa43c215SJeff Kirsher 	QLCNIC_PRIV_FUNC	= 1,
807*7f966452SSony Chacko 	QLCNIC_NON_PRIV_FUNC	= 2,
808*7f966452SSony Chacko 	QLCNIC_UNKNOWN_FUNC_MODE = 3
809aa43c215SJeff Kirsher };
810aa43c215SJeff Kirsher 
811aa43c215SJeff Kirsher enum {
812aa43c215SJeff Kirsher 	QLCNIC_PORT_DEFAULTS	= 0,
813aa43c215SJeff Kirsher 	QLCNIC_ADD_VLAN	= 1,
814aa43c215SJeff Kirsher 	QLCNIC_DEL_VLAN	= 2
815aa43c215SJeff Kirsher };
816aa43c215SJeff Kirsher 
817aa43c215SJeff Kirsher #define QLC_DEV_DRV_DEFAULT 0x11111111
818aa43c215SJeff Kirsher 
819aa43c215SJeff Kirsher #define LSB(x)	((uint8_t)(x))
820aa43c215SJeff Kirsher #define MSB(x)	((uint8_t)((uint16_t)(x) >> 8))
821aa43c215SJeff Kirsher 
822aa43c215SJeff Kirsher #define LSW(x)  ((uint16_t)((uint32_t)(x)))
823aa43c215SJeff Kirsher #define MSW(x)  ((uint16_t)((uint32_t)(x) >> 16))
824aa43c215SJeff Kirsher 
825aa43c215SJeff Kirsher #define LSD(x)  ((uint32_t)((uint64_t)(x)))
826aa43c215SJeff Kirsher #define MSD(x)  ((uint32_t)((((uint64_t)(x)) >> 16) >> 16))
827aa43c215SJeff Kirsher 
82815087c2bSSony Chacko #define QLCNIC_MS_CTRL			0x41000090
82915087c2bSSony Chacko #define QLCNIC_MS_ADDR_LO		0x41000094
83015087c2bSSony Chacko #define QLCNIC_MS_ADDR_HI		0x41000098
83115087c2bSSony Chacko #define QLCNIC_MS_WRTDATA_LO		0x410000A0
83215087c2bSSony Chacko #define QLCNIC_MS_WRTDATA_HI		0x410000A4
83315087c2bSSony Chacko #define QLCNIC_MS_WRTDATA_ULO		0x410000B0
83415087c2bSSony Chacko #define QLCNIC_MS_WRTDATA_UHI		0x410000B4
83515087c2bSSony Chacko #define QLCNIC_MS_RDDATA_LO		0x410000A8
83615087c2bSSony Chacko #define QLCNIC_MS_RDDATA_HI		0x410000AC
83715087c2bSSony Chacko #define QLCNIC_MS_RDDATA_ULO		0x410000B8
83815087c2bSSony Chacko #define QLCNIC_MS_RDDATA_UHI		0x410000BC
83915087c2bSSony Chacko 
84015087c2bSSony Chacko #define QLCNIC_TA_WRITE_ENABLE	(TA_CTL_ENABLE | TA_CTL_WRITE)
84115087c2bSSony Chacko #define QLCNIC_TA_WRITE_START	(TA_CTL_START | TA_CTL_ENABLE | TA_CTL_WRITE)
84215087c2bSSony Chacko #define QLCNIC_TA_START_ENABLE	(TA_CTL_START | TA_CTL_ENABLE)
84315087c2bSSony Chacko 
844aa43c215SJeff Kirsher #define	QLCNIC_LEGACY_INTR_CONFIG					\
845aa43c215SJeff Kirsher {									\
846aa43c215SJeff Kirsher 	{								\
847aa43c215SJeff Kirsher 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F0,		\
848aa43c215SJeff Kirsher 		.tgt_status_reg	=	ISR_INT_TARGET_STATUS,		\
84915087c2bSSony Chacko 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK, },		\
850aa43c215SJeff Kirsher 									\
851aa43c215SJeff Kirsher 	{								\
852aa43c215SJeff Kirsher 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F1,		\
853aa43c215SJeff Kirsher 		.tgt_status_reg	=	ISR_INT_TARGET_STATUS_F1,	\
85415087c2bSSony Chacko 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F1, },	\
855aa43c215SJeff Kirsher 									\
856aa43c215SJeff Kirsher 	{								\
857aa43c215SJeff Kirsher 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F2,		\
858aa43c215SJeff Kirsher 		.tgt_status_reg	=	ISR_INT_TARGET_STATUS_F2,	\
85915087c2bSSony Chacko 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F2, },	\
860aa43c215SJeff Kirsher 									\
861aa43c215SJeff Kirsher 	{								\
862aa43c215SJeff Kirsher 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F3,		\
863aa43c215SJeff Kirsher 		.tgt_status_reg	=	ISR_INT_TARGET_STATUS_F3,	\
86415087c2bSSony Chacko 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F3, },	\
865aa43c215SJeff Kirsher 									\
866aa43c215SJeff Kirsher 	{								\
867aa43c215SJeff Kirsher 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F4,		\
868aa43c215SJeff Kirsher 		.tgt_status_reg	=	ISR_INT_TARGET_STATUS_F4,	\
86915087c2bSSony Chacko 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F4, },	\
870aa43c215SJeff Kirsher 									\
871aa43c215SJeff Kirsher 	{								\
872aa43c215SJeff Kirsher 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F5,		\
873aa43c215SJeff Kirsher 		.tgt_status_reg	=	ISR_INT_TARGET_STATUS_F5,	\
87415087c2bSSony Chacko 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F5, },	\
875aa43c215SJeff Kirsher 									\
876aa43c215SJeff Kirsher 	{								\
877aa43c215SJeff Kirsher 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F6,		\
878aa43c215SJeff Kirsher 		.tgt_status_reg	=	ISR_INT_TARGET_STATUS_F6,	\
87915087c2bSSony Chacko 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F6, },	\
880aa43c215SJeff Kirsher 									\
881aa43c215SJeff Kirsher 	{								\
882aa43c215SJeff Kirsher 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F7,		\
883aa43c215SJeff Kirsher 		.tgt_status_reg	=	ISR_INT_TARGET_STATUS_F7,	\
88415087c2bSSony Chacko 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F7, },	\
885aa43c215SJeff Kirsher }
886aa43c215SJeff Kirsher 
887aa43c215SJeff Kirsher /* NIU REGS */
888aa43c215SJeff Kirsher 
889aa43c215SJeff Kirsher #define _qlcnic_crb_get_bit(var, bit)  ((var >> bit) & 0x1)
890aa43c215SJeff Kirsher 
891aa43c215SJeff Kirsher /*
892aa43c215SJeff Kirsher  * NIU GB MAC Config Register 0 (applies to GB0, GB1, GB2, GB3)
893aa43c215SJeff Kirsher  *
894aa43c215SJeff Kirsher  *	Bit 0 : enable_tx => 1:enable frame xmit, 0:disable
895aa43c215SJeff Kirsher  *	Bit 1 : tx_synced => R/O: xmit enable synched to xmit stream
896aa43c215SJeff Kirsher  *	Bit 2 : enable_rx => 1:enable frame recv, 0:disable
897aa43c215SJeff Kirsher  *	Bit 3 : rx_synced => R/O: recv enable synched to recv stream
898aa43c215SJeff Kirsher  *	Bit 4 : tx_flowctl => 1:enable pause frame generation, 0:disable
899aa43c215SJeff Kirsher  *	Bit 5 : rx_flowctl => 1:act on recv'd pause frames, 0:ignore
900aa43c215SJeff Kirsher  *	Bit 8 : loopback => 1:loop MAC xmits to MAC recvs, 0:normal
901aa43c215SJeff Kirsher  *	Bit 16: tx_reset_pb => 1:reset frame xmit protocol blk, 0:no-op
902aa43c215SJeff Kirsher  *	Bit 17: rx_reset_pb => 1:reset frame recv protocol blk, 0:no-op
903aa43c215SJeff Kirsher  *	Bit 18: tx_reset_mac => 1:reset data/ctl multiplexer blk, 0:no-op
904aa43c215SJeff Kirsher  *	Bit 19: rx_reset_mac => 1:reset ctl frames & timers blk, 0:no-op
905aa43c215SJeff Kirsher  *	Bit 31: soft_reset => 1:reset the MAC and the SERDES, 0:no-op
906aa43c215SJeff Kirsher  */
907aa43c215SJeff Kirsher #define qlcnic_gb_rx_flowctl(config_word)	\
908aa43c215SJeff Kirsher 	((config_word) |= 1 << 5)
909aa43c215SJeff Kirsher #define qlcnic_gb_get_rx_flowctl(config_word)	\
910aa43c215SJeff Kirsher 	_qlcnic_crb_get_bit((config_word), 5)
911aa43c215SJeff Kirsher #define qlcnic_gb_unset_rx_flowctl(config_word)	\
912aa43c215SJeff Kirsher 	((config_word) &= ~(1 << 5))
913aa43c215SJeff Kirsher 
914aa43c215SJeff Kirsher /*
915aa43c215SJeff Kirsher  * NIU GB Pause Ctl Register
916aa43c215SJeff Kirsher  */
917aa43c215SJeff Kirsher 
918aa43c215SJeff Kirsher #define qlcnic_gb_set_gb0_mask(config_word)    \
919aa43c215SJeff Kirsher 	((config_word) |= 1 << 0)
920aa43c215SJeff Kirsher #define qlcnic_gb_set_gb1_mask(config_word)    \
921aa43c215SJeff Kirsher 	((config_word) |= 1 << 2)
922aa43c215SJeff Kirsher #define qlcnic_gb_set_gb2_mask(config_word)    \
923aa43c215SJeff Kirsher 	((config_word) |= 1 << 4)
924aa43c215SJeff Kirsher #define qlcnic_gb_set_gb3_mask(config_word)    \
925aa43c215SJeff Kirsher 	((config_word) |= 1 << 6)
926aa43c215SJeff Kirsher 
927aa43c215SJeff Kirsher #define qlcnic_gb_get_gb0_mask(config_word)    \
928aa43c215SJeff Kirsher 	_qlcnic_crb_get_bit((config_word), 0)
929aa43c215SJeff Kirsher #define qlcnic_gb_get_gb1_mask(config_word)    \
930aa43c215SJeff Kirsher 	_qlcnic_crb_get_bit((config_word), 2)
931aa43c215SJeff Kirsher #define qlcnic_gb_get_gb2_mask(config_word)    \
932aa43c215SJeff Kirsher 	_qlcnic_crb_get_bit((config_word), 4)
933aa43c215SJeff Kirsher #define qlcnic_gb_get_gb3_mask(config_word)    \
934aa43c215SJeff Kirsher 	_qlcnic_crb_get_bit((config_word), 6)
935aa43c215SJeff Kirsher 
936aa43c215SJeff Kirsher #define qlcnic_gb_unset_gb0_mask(config_word)  \
937aa43c215SJeff Kirsher 	((config_word) &= ~(1 << 0))
938aa43c215SJeff Kirsher #define qlcnic_gb_unset_gb1_mask(config_word)  \
939aa43c215SJeff Kirsher 	((config_word) &= ~(1 << 2))
940aa43c215SJeff Kirsher #define qlcnic_gb_unset_gb2_mask(config_word)  \
941aa43c215SJeff Kirsher 	((config_word) &= ~(1 << 4))
942aa43c215SJeff Kirsher #define qlcnic_gb_unset_gb3_mask(config_word)  \
943aa43c215SJeff Kirsher 	((config_word) &= ~(1 << 6))
944aa43c215SJeff Kirsher 
945aa43c215SJeff Kirsher /*
946aa43c215SJeff Kirsher  * NIU XG Pause Ctl Register
947aa43c215SJeff Kirsher  *
948aa43c215SJeff Kirsher  *      Bit 0       : xg0_mask => 1:disable tx pause frames
949aa43c215SJeff Kirsher  *      Bit 1       : xg0_request => 1:request single pause frame
950aa43c215SJeff Kirsher  *      Bit 2       : xg0_on_off => 1:request is pause on, 0:off
951aa43c215SJeff Kirsher  *      Bit 3       : xg1_mask => 1:disable tx pause frames
952aa43c215SJeff Kirsher  *      Bit 4       : xg1_request => 1:request single pause frame
953aa43c215SJeff Kirsher  *      Bit 5       : xg1_on_off => 1:request is pause on, 0:off
954aa43c215SJeff Kirsher  */
955aa43c215SJeff Kirsher 
956aa43c215SJeff Kirsher #define qlcnic_xg_set_xg0_mask(config_word)    \
957aa43c215SJeff Kirsher 	((config_word) |= 1 << 0)
958aa43c215SJeff Kirsher #define qlcnic_xg_set_xg1_mask(config_word)    \
959aa43c215SJeff Kirsher 	((config_word) |= 1 << 3)
960aa43c215SJeff Kirsher 
961aa43c215SJeff Kirsher #define qlcnic_xg_get_xg0_mask(config_word)    \
962aa43c215SJeff Kirsher 	_qlcnic_crb_get_bit((config_word), 0)
963aa43c215SJeff Kirsher #define qlcnic_xg_get_xg1_mask(config_word)    \
964aa43c215SJeff Kirsher 	_qlcnic_crb_get_bit((config_word), 3)
965aa43c215SJeff Kirsher 
966aa43c215SJeff Kirsher #define qlcnic_xg_unset_xg0_mask(config_word)  \
967aa43c215SJeff Kirsher 	((config_word) &= ~(1 << 0))
968aa43c215SJeff Kirsher #define qlcnic_xg_unset_xg1_mask(config_word)  \
969aa43c215SJeff Kirsher 	((config_word) &= ~(1 << 3))
970aa43c215SJeff Kirsher 
971aa43c215SJeff Kirsher /*
972aa43c215SJeff Kirsher  * NIU XG Pause Ctl Register
973aa43c215SJeff Kirsher  *
974aa43c215SJeff Kirsher  *      Bit 0       : xg0_mask => 1:disable tx pause frames
975aa43c215SJeff Kirsher  *      Bit 1       : xg0_request => 1:request single pause frame
976aa43c215SJeff Kirsher  *      Bit 2       : xg0_on_off => 1:request is pause on, 0:off
977aa43c215SJeff Kirsher  *      Bit 3       : xg1_mask => 1:disable tx pause frames
978aa43c215SJeff Kirsher  *      Bit 4       : xg1_request => 1:request single pause frame
979aa43c215SJeff Kirsher  *      Bit 5       : xg1_on_off => 1:request is pause on, 0:off
980aa43c215SJeff Kirsher  */
981aa43c215SJeff Kirsher 
982aa43c215SJeff Kirsher /*
983aa43c215SJeff Kirsher  * PHY-Specific MII control/status registers.
984aa43c215SJeff Kirsher  */
985aa43c215SJeff Kirsher #define QLCNIC_NIU_GB_MII_MGMT_ADDR_AUTONEG		4
986aa43c215SJeff Kirsher #define QLCNIC_NIU_GB_MII_MGMT_ADDR_PHY_STATUS		17
987aa43c215SJeff Kirsher 
988aa43c215SJeff Kirsher /*
989aa43c215SJeff Kirsher  * PHY-Specific Status Register (reg 17).
990aa43c215SJeff Kirsher  *
991aa43c215SJeff Kirsher  * Bit 0      : jabber => 1:jabber detected, 0:not
992aa43c215SJeff Kirsher  * Bit 1      : polarity => 1:polarity reversed, 0:normal
993aa43c215SJeff Kirsher  * Bit 2      : recvpause => 1:receive pause enabled, 0:disabled
994aa43c215SJeff Kirsher  * Bit 3      : xmitpause => 1:transmit pause enabled, 0:disabled
995aa43c215SJeff Kirsher  * Bit 4      : energydetect => 1:sleep, 0:active
996aa43c215SJeff Kirsher  * Bit 5      : downshift => 1:downshift, 0:no downshift
997aa43c215SJeff Kirsher  * Bit 6      : crossover => 1:MDIX (crossover), 0:MDI (no crossover)
998aa43c215SJeff Kirsher  * Bits 7-9   : cablelen => not valid in 10Mb/s mode
999aa43c215SJeff Kirsher  *			0:<50m, 1:50-80m, 2:80-110m, 3:110-140m, 4:>140m
1000aa43c215SJeff Kirsher  * Bit 10     : link => 1:link up, 0:link down
1001aa43c215SJeff Kirsher  * Bit 11     : resolved => 1:speed and duplex resolved, 0:not yet
1002aa43c215SJeff Kirsher  * Bit 12     : pagercvd => 1:page received, 0:page not received
1003aa43c215SJeff Kirsher  * Bit 13     : duplex => 1:full duplex, 0:half duplex
1004aa43c215SJeff Kirsher  * Bits 14-15 : speed => 0:10Mb/s, 1:100Mb/s, 2:1000Mb/s, 3:rsvd
1005aa43c215SJeff Kirsher  */
1006aa43c215SJeff Kirsher 
1007aa43c215SJeff Kirsher #define qlcnic_get_phy_speed(config_word) (((config_word) >> 14) & 0x03)
1008aa43c215SJeff Kirsher 
1009aa43c215SJeff Kirsher #define qlcnic_set_phy_speed(config_word, val)	\
1010aa43c215SJeff Kirsher 		((config_word) |= ((val & 0x03) << 14))
1011aa43c215SJeff Kirsher #define qlcnic_set_phy_duplex(config_word)	\
1012aa43c215SJeff Kirsher 		((config_word) |= 1 << 13)
1013aa43c215SJeff Kirsher #define qlcnic_clear_phy_duplex(config_word)	\
1014aa43c215SJeff Kirsher 		((config_word) &= ~(1 << 13))
1015aa43c215SJeff Kirsher 
1016aa43c215SJeff Kirsher #define qlcnic_get_phy_link(config_word)	\
1017aa43c215SJeff Kirsher 		_qlcnic_crb_get_bit(config_word, 10)
1018aa43c215SJeff Kirsher #define qlcnic_get_phy_duplex(config_word)	\
1019aa43c215SJeff Kirsher 		_qlcnic_crb_get_bit(config_word, 13)
1020aa43c215SJeff Kirsher 
1021aa43c215SJeff Kirsher #define QLCNIC_NIU_NON_PROMISC_MODE	0
1022aa43c215SJeff Kirsher #define QLCNIC_NIU_PROMISC_MODE		1
1023aa43c215SJeff Kirsher #define QLCNIC_NIU_ALLMULTI_MODE	2
1024aa43c215SJeff Kirsher 
1025*7f966452SSony Chacko #define QLCNIC_PCIE_SEM_TIMEOUT	10000
1026*7f966452SSony Chacko 
1027aa43c215SJeff Kirsher struct crb_128M_2M_sub_block_map {
1028aa43c215SJeff Kirsher 	unsigned valid;
1029aa43c215SJeff Kirsher 	unsigned start_128M;
1030aa43c215SJeff Kirsher 	unsigned end_128M;
1031aa43c215SJeff Kirsher 	unsigned start_2M;
1032aa43c215SJeff Kirsher };
1033aa43c215SJeff Kirsher 
1034aa43c215SJeff Kirsher struct crb_128M_2M_block_map{
1035aa43c215SJeff Kirsher 	struct crb_128M_2M_sub_block_map sub_block[16];
1036aa43c215SJeff Kirsher };
1037aa43c215SJeff Kirsher #endif				/* __QLCNIC_HDR_H_ */
1038