blob: cfb2f2edac3a9365b490cda5e182f935b671eec6 [file] [log] [blame]
Vikas Chaudharyf4f5df22010-07-28 15:53:44 +05301/*
Vikas Chaudhary7d01d062010-12-02 22:12:51 -08002 * QLogic iSCSI HBA Driver
3 * Copyright (c) 2003-2010 QLogic Corporation
Vikas Chaudharyf4f5df22010-07-28 15:53:44 +05304 *
Vikas Chaudhary7d01d062010-12-02 22:12:51 -08005 * See LICENSE.qla4xxx for copyright and licensing details.
Vikas Chaudharyf4f5df22010-07-28 15:53:44 +05306 */
7#ifndef __QLA_NX_H
8#define __QLA_NX_H
9
10/*
11 * Following are the states of the Phantom. Phantom will set them and
12 * Host will read to check if the fields are correct.
13*/
14#define PHAN_INITIALIZE_FAILED 0xffff
15#define PHAN_INITIALIZE_COMPLETE 0xff01
16
17/* Host writes the following to notify that it has done the init-handshake */
18#define PHAN_INITIALIZE_ACK 0xf00f
19#define PHAN_PEG_RCV_INITIALIZED 0xff01
20
21/*CRB_RELATED*/
Mike Hernandez4f770832012-01-11 02:44:15 -080022#define QLA82XX_CRB_BASE (QLA82XX_CAM_RAM(0x200))
23#define QLA82XX_REG(X) (QLA82XX_CRB_BASE+(X))
Vikas Chaudharyf4f5df22010-07-28 15:53:44 +053024#define CRB_CMDPEG_STATE QLA82XX_REG(0x50)
25#define CRB_RCVPEG_STATE QLA82XX_REG(0x13c)
Vikas Chaudharyf4f5df22010-07-28 15:53:44 +053026#define CRB_DMA_SHIFT QLA82XX_REG(0xcc)
Mike Hernandez4f770832012-01-11 02:44:15 -080027#define CRB_TEMP_STATE QLA82XX_REG(0x1b4)
28
29#define qla82xx_get_temp_val(x) ((x) >> 16)
30#define qla82xx_get_temp_state(x) ((x) & 0xffff)
31#define qla82xx_encode_temp(val, state) (((val) << 16) | (state))
32
33/*
34 * Temperature control.
35 */
36enum {
37 QLA82XX_TEMP_NORMAL = 0x1, /* Normal operating range */
38 QLA82XX_TEMP_WARN, /* Sound alert, temperature getting high */
39 QLA82XX_TEMP_PANIC /* Fatal error, hardware has shut down. */
40};
Vikas Chaudharyf4f5df22010-07-28 15:53:44 +053041
42#define QLA82XX_HW_H0_CH_HUB_ADR 0x05
43#define QLA82XX_HW_H1_CH_HUB_ADR 0x0E
44#define QLA82XX_HW_H2_CH_HUB_ADR 0x03
45#define QLA82XX_HW_H3_CH_HUB_ADR 0x01
46#define QLA82XX_HW_H4_CH_HUB_ADR 0x06
47#define QLA82XX_HW_H5_CH_HUB_ADR 0x07
48#define QLA82XX_HW_H6_CH_HUB_ADR 0x08
49
50/* Hub 0 */
51#define QLA82XX_HW_MN_CRB_AGT_ADR 0x15
52#define QLA82XX_HW_MS_CRB_AGT_ADR 0x25
53
54/* Hub 1 */
55#define QLA82XX_HW_PS_CRB_AGT_ADR 0x73
56#define QLA82XX_HW_QMS_CRB_AGT_ADR 0x00
57#define QLA82XX_HW_RPMX3_CRB_AGT_ADR 0x0b
58#define QLA82XX_HW_SQGS0_CRB_AGT_ADR 0x01
59#define QLA82XX_HW_SQGS1_CRB_AGT_ADR 0x02
60#define QLA82XX_HW_SQGS2_CRB_AGT_ADR 0x03
61#define QLA82XX_HW_SQGS3_CRB_AGT_ADR 0x04
62#define QLA82XX_HW_C2C0_CRB_AGT_ADR 0x58
63#define QLA82XX_HW_C2C1_CRB_AGT_ADR 0x59
64#define QLA82XX_HW_C2C2_CRB_AGT_ADR 0x5a
65#define QLA82XX_HW_RPMX2_CRB_AGT_ADR 0x0a
66#define QLA82XX_HW_RPMX4_CRB_AGT_ADR 0x0c
67#define QLA82XX_HW_RPMX7_CRB_AGT_ADR 0x0f
68#define QLA82XX_HW_RPMX9_CRB_AGT_ADR 0x12
69#define QLA82XX_HW_SMB_CRB_AGT_ADR 0x18
70
71/* Hub 2 */
72#define QLA82XX_HW_NIU_CRB_AGT_ADR 0x31
73#define QLA82XX_HW_I2C0_CRB_AGT_ADR 0x19
74#define QLA82XX_HW_I2C1_CRB_AGT_ADR 0x29
75
76#define QLA82XX_HW_SN_CRB_AGT_ADR 0x10
77#define QLA82XX_HW_I2Q_CRB_AGT_ADR 0x20
78#define QLA82XX_HW_LPC_CRB_AGT_ADR 0x22
79#define QLA82XX_HW_ROMUSB_CRB_AGT_ADR 0x21
80#define QLA82XX_HW_QM_CRB_AGT_ADR 0x66
81#define QLA82XX_HW_SQG0_CRB_AGT_ADR 0x60
82#define QLA82XX_HW_SQG1_CRB_AGT_ADR 0x61
83#define QLA82XX_HW_SQG2_CRB_AGT_ADR 0x62
84#define QLA82XX_HW_SQG3_CRB_AGT_ADR 0x63
85#define QLA82XX_HW_RPMX1_CRB_AGT_ADR 0x09
86#define QLA82XX_HW_RPMX5_CRB_AGT_ADR 0x0d
87#define QLA82XX_HW_RPMX6_CRB_AGT_ADR 0x0e
88#define QLA82XX_HW_RPMX8_CRB_AGT_ADR 0x11
89
90/* Hub 3 */
91#define QLA82XX_HW_PH_CRB_AGT_ADR 0x1A
92#define QLA82XX_HW_SRE_CRB_AGT_ADR 0x50
93#define QLA82XX_HW_EG_CRB_AGT_ADR 0x51
94#define QLA82XX_HW_RPMX0_CRB_AGT_ADR 0x08
95
96/* Hub 4 */
97#define QLA82XX_HW_PEGN0_CRB_AGT_ADR 0x40
98#define QLA82XX_HW_PEGN1_CRB_AGT_ADR 0x41
99#define QLA82XX_HW_PEGN2_CRB_AGT_ADR 0x42
100#define QLA82XX_HW_PEGN3_CRB_AGT_ADR 0x43
101#define QLA82XX_HW_PEGNI_CRB_AGT_ADR 0x44
102#define QLA82XX_HW_PEGND_CRB_AGT_ADR 0x45
103#define QLA82XX_HW_PEGNC_CRB_AGT_ADR 0x46
104#define QLA82XX_HW_PEGR0_CRB_AGT_ADR 0x47
105#define QLA82XX_HW_PEGR1_CRB_AGT_ADR 0x48
106#define QLA82XX_HW_PEGR2_CRB_AGT_ADR 0x49
107#define QLA82XX_HW_PEGR3_CRB_AGT_ADR 0x4a
108#define QLA82XX_HW_PEGN4_CRB_AGT_ADR 0x4b
109
110/* Hub 5 */
111#define QLA82XX_HW_PEGS0_CRB_AGT_ADR 0x40
112#define QLA82XX_HW_PEGS1_CRB_AGT_ADR 0x41
113#define QLA82XX_HW_PEGS2_CRB_AGT_ADR 0x42
114#define QLA82XX_HW_PEGS3_CRB_AGT_ADR 0x43
115
116#define QLA82XX_HW_PEGSI_CRB_AGT_ADR 0x44
117#define QLA82XX_HW_PEGSD_CRB_AGT_ADR 0x45
118#define QLA82XX_HW_PEGSC_CRB_AGT_ADR 0x46
119
120/* Hub 6 */
121#define QLA82XX_HW_CAS0_CRB_AGT_ADR 0x46
122#define QLA82XX_HW_CAS1_CRB_AGT_ADR 0x47
123#define QLA82XX_HW_CAS2_CRB_AGT_ADR 0x48
124#define QLA82XX_HW_CAS3_CRB_AGT_ADR 0x49
125#define QLA82XX_HW_NCM_CRB_AGT_ADR 0x16
126#define QLA82XX_HW_TMR_CRB_AGT_ADR 0x17
127#define QLA82XX_HW_XDMA_CRB_AGT_ADR 0x05
128#define QLA82XX_HW_OCM0_CRB_AGT_ADR 0x06
129#define QLA82XX_HW_OCM1_CRB_AGT_ADR 0x07
130
131/* This field defines PCI/X adr [25:20] of agents on the CRB */
132/* */
133#define QLA82XX_HW_PX_MAP_CRB_PH 0
134#define QLA82XX_HW_PX_MAP_CRB_PS 1
135#define QLA82XX_HW_PX_MAP_CRB_MN 2
136#define QLA82XX_HW_PX_MAP_CRB_MS 3
137#define QLA82XX_HW_PX_MAP_CRB_SRE 5
138#define QLA82XX_HW_PX_MAP_CRB_NIU 6
139#define QLA82XX_HW_PX_MAP_CRB_QMN 7
140#define QLA82XX_HW_PX_MAP_CRB_SQN0 8
141#define QLA82XX_HW_PX_MAP_CRB_SQN1 9
142#define QLA82XX_HW_PX_MAP_CRB_SQN2 10
143#define QLA82XX_HW_PX_MAP_CRB_SQN3 11
144#define QLA82XX_HW_PX_MAP_CRB_QMS 12
145#define QLA82XX_HW_PX_MAP_CRB_SQS0 13
146#define QLA82XX_HW_PX_MAP_CRB_SQS1 14
147#define QLA82XX_HW_PX_MAP_CRB_SQS2 15
148#define QLA82XX_HW_PX_MAP_CRB_SQS3 16
149#define QLA82XX_HW_PX_MAP_CRB_PGN0 17
150#define QLA82XX_HW_PX_MAP_CRB_PGN1 18
151#define QLA82XX_HW_PX_MAP_CRB_PGN2 19
152#define QLA82XX_HW_PX_MAP_CRB_PGN3 20
153#define QLA82XX_HW_PX_MAP_CRB_PGN4 QLA82XX_HW_PX_MAP_CRB_SQS2
154#define QLA82XX_HW_PX_MAP_CRB_PGND 21
155#define QLA82XX_HW_PX_MAP_CRB_PGNI 22
156#define QLA82XX_HW_PX_MAP_CRB_PGS0 23
157#define QLA82XX_HW_PX_MAP_CRB_PGS1 24
158#define QLA82XX_HW_PX_MAP_CRB_PGS2 25
159#define QLA82XX_HW_PX_MAP_CRB_PGS3 26
160#define QLA82XX_HW_PX_MAP_CRB_PGSD 27
161#define QLA82XX_HW_PX_MAP_CRB_PGSI 28
162#define QLA82XX_HW_PX_MAP_CRB_SN 29
163#define QLA82XX_HW_PX_MAP_CRB_EG 31
164#define QLA82XX_HW_PX_MAP_CRB_PH2 32
165#define QLA82XX_HW_PX_MAP_CRB_PS2 33
166#define QLA82XX_HW_PX_MAP_CRB_CAM 34
167#define QLA82XX_HW_PX_MAP_CRB_CAS0 35
168#define QLA82XX_HW_PX_MAP_CRB_CAS1 36
169#define QLA82XX_HW_PX_MAP_CRB_CAS2 37
170#define QLA82XX_HW_PX_MAP_CRB_C2C0 38
171#define QLA82XX_HW_PX_MAP_CRB_C2C1 39
172#define QLA82XX_HW_PX_MAP_CRB_TIMR 40
173#define QLA82XX_HW_PX_MAP_CRB_RPMX1 42
174#define QLA82XX_HW_PX_MAP_CRB_RPMX2 43
175#define QLA82XX_HW_PX_MAP_CRB_RPMX3 44
176#define QLA82XX_HW_PX_MAP_CRB_RPMX4 45
177#define QLA82XX_HW_PX_MAP_CRB_RPMX5 46
178#define QLA82XX_HW_PX_MAP_CRB_RPMX6 47
179#define QLA82XX_HW_PX_MAP_CRB_RPMX7 48
180#define QLA82XX_HW_PX_MAP_CRB_XDMA 49
181#define QLA82XX_HW_PX_MAP_CRB_I2Q 50
182#define QLA82XX_HW_PX_MAP_CRB_ROMUSB 51
183#define QLA82XX_HW_PX_MAP_CRB_CAS3 52
184#define QLA82XX_HW_PX_MAP_CRB_RPMX0 53
185#define QLA82XX_HW_PX_MAP_CRB_RPMX8 54
186#define QLA82XX_HW_PX_MAP_CRB_RPMX9 55
187#define QLA82XX_HW_PX_MAP_CRB_OCM0 56
188#define QLA82XX_HW_PX_MAP_CRB_OCM1 57
189#define QLA82XX_HW_PX_MAP_CRB_SMB 58
190#define QLA82XX_HW_PX_MAP_CRB_I2C0 59
191#define QLA82XX_HW_PX_MAP_CRB_I2C1 60
192#define QLA82XX_HW_PX_MAP_CRB_LPC 61
193#define QLA82XX_HW_PX_MAP_CRB_PGNC 62
194#define QLA82XX_HW_PX_MAP_CRB_PGR0 63
195#define QLA82XX_HW_PX_MAP_CRB_PGR1 4
196#define QLA82XX_HW_PX_MAP_CRB_PGR2 30
197#define QLA82XX_HW_PX_MAP_CRB_PGR3 41
198
199/* This field defines CRB adr [31:20] of the agents */
200/* */
201
202#define QLA82XX_HW_CRB_HUB_AGT_ADR_MN ((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
203 QLA82XX_HW_MN_CRB_AGT_ADR)
204#define QLA82XX_HW_CRB_HUB_AGT_ADR_PH ((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
205 QLA82XX_HW_PH_CRB_AGT_ADR)
206#define QLA82XX_HW_CRB_HUB_AGT_ADR_MS ((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
207 QLA82XX_HW_MS_CRB_AGT_ADR)
208#define QLA82XX_HW_CRB_HUB_AGT_ADR_PS ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
209 QLA82XX_HW_PS_CRB_AGT_ADR)
210#define QLA82XX_HW_CRB_HUB_AGT_ADR_SS ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
211 QLA82XX_HW_SS_CRB_AGT_ADR)
212#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX3 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
213 QLA82XX_HW_RPMX3_CRB_AGT_ADR)
214#define QLA82XX_HW_CRB_HUB_AGT_ADR_QMS ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
215 QLA82XX_HW_QMS_CRB_AGT_ADR)
216#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS0 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
217 QLA82XX_HW_SQGS0_CRB_AGT_ADR)
218#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS1 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
219 QLA82XX_HW_SQGS1_CRB_AGT_ADR)
220#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS2 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
221 QLA82XX_HW_SQGS2_CRB_AGT_ADR)
222#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS3 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
223 QLA82XX_HW_SQGS3_CRB_AGT_ADR)
224#define QLA82XX_HW_CRB_HUB_AGT_ADR_C2C0 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
225 QLA82XX_HW_C2C0_CRB_AGT_ADR)
226#define QLA82XX_HW_CRB_HUB_AGT_ADR_C2C1 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
227 QLA82XX_HW_C2C1_CRB_AGT_ADR)
228#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX2 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
229 QLA82XX_HW_RPMX2_CRB_AGT_ADR)
230#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX4 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
231 QLA82XX_HW_RPMX4_CRB_AGT_ADR)
232#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX7 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
233 QLA82XX_HW_RPMX7_CRB_AGT_ADR)
234#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX9 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
235 QLA82XX_HW_RPMX9_CRB_AGT_ADR)
236#define QLA82XX_HW_CRB_HUB_AGT_ADR_SMB ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
237 QLA82XX_HW_SMB_CRB_AGT_ADR)
238
239#define QLA82XX_HW_CRB_HUB_AGT_ADR_NIU ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
240 QLA82XX_HW_NIU_CRB_AGT_ADR)
241#define QLA82XX_HW_CRB_HUB_AGT_ADR_I2C0 ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
242 QLA82XX_HW_I2C0_CRB_AGT_ADR)
243#define QLA82XX_HW_CRB_HUB_AGT_ADR_I2C1 ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
244 QLA82XX_HW_I2C1_CRB_AGT_ADR)
245
246#define QLA82XX_HW_CRB_HUB_AGT_ADR_SRE ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
247 QLA82XX_HW_SRE_CRB_AGT_ADR)
248#define QLA82XX_HW_CRB_HUB_AGT_ADR_EG ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
249 QLA82XX_HW_EG_CRB_AGT_ADR)
250#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX0 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
251 QLA82XX_HW_RPMX0_CRB_AGT_ADR)
252#define QLA82XX_HW_CRB_HUB_AGT_ADR_QMN ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
253 QLA82XX_HW_QM_CRB_AGT_ADR)
254#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN0 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
255 QLA82XX_HW_SQG0_CRB_AGT_ADR)
256#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN1 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
257 QLA82XX_HW_SQG1_CRB_AGT_ADR)
258#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN2 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
259 QLA82XX_HW_SQG2_CRB_AGT_ADR)
260#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN3 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
261 QLA82XX_HW_SQG3_CRB_AGT_ADR)
262#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX1 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
263 QLA82XX_HW_RPMX1_CRB_AGT_ADR)
264#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX5 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
265 QLA82XX_HW_RPMX5_CRB_AGT_ADR)
266#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX6 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
267 QLA82XX_HW_RPMX6_CRB_AGT_ADR)
268#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX8 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
269 QLA82XX_HW_RPMX8_CRB_AGT_ADR)
270#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS0 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
271 QLA82XX_HW_CAS0_CRB_AGT_ADR)
272#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS1 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
273 QLA82XX_HW_CAS1_CRB_AGT_ADR)
274#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS2 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
275 QLA82XX_HW_CAS2_CRB_AGT_ADR)
276#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS3 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
277 QLA82XX_HW_CAS3_CRB_AGT_ADR)
278
279#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGNI ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
280 QLA82XX_HW_PEGNI_CRB_AGT_ADR)
281#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGND ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
282 QLA82XX_HW_PEGND_CRB_AGT_ADR)
283#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN0 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
284 QLA82XX_HW_PEGN0_CRB_AGT_ADR)
285#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN1 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
286 QLA82XX_HW_PEGN1_CRB_AGT_ADR)
287#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN2 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
288 QLA82XX_HW_PEGN2_CRB_AGT_ADR)
289#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN3 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
290 QLA82XX_HW_PEGN3_CRB_AGT_ADR)
291#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN4 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
292 QLA82XX_HW_PEGN4_CRB_AGT_ADR)
293
294#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGNC ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
295 QLA82XX_HW_PEGNC_CRB_AGT_ADR)
296#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR0 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
297 QLA82XX_HW_PEGR0_CRB_AGT_ADR)
298#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR1 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
299 QLA82XX_HW_PEGR1_CRB_AGT_ADR)
300#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR2 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
301 QLA82XX_HW_PEGR2_CRB_AGT_ADR)
302#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR3 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
303 QLA82XX_HW_PEGR3_CRB_AGT_ADR)
304
305#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSI ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
306 QLA82XX_HW_PEGSI_CRB_AGT_ADR)
307#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSD ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
308 QLA82XX_HW_PEGSD_CRB_AGT_ADR)
309#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS0 ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
310 QLA82XX_HW_PEGS0_CRB_AGT_ADR)
311#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS1 ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
312 QLA82XX_HW_PEGS1_CRB_AGT_ADR)
313#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS2 ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
314 QLA82XX_HW_PEGS2_CRB_AGT_ADR)
315#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS3 ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
316 QLA82XX_HW_PEGS3_CRB_AGT_ADR)
317#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSC ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
318 QLA82XX_HW_PEGSC_CRB_AGT_ADR)
319
320#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAM ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
321 QLA82XX_HW_NCM_CRB_AGT_ADR)
322#define QLA82XX_HW_CRB_HUB_AGT_ADR_TIMR ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
323 QLA82XX_HW_TMR_CRB_AGT_ADR)
324#define QLA82XX_HW_CRB_HUB_AGT_ADR_XDMA ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
325 QLA82XX_HW_XDMA_CRB_AGT_ADR)
326#define QLA82XX_HW_CRB_HUB_AGT_ADR_SN ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
327 QLA82XX_HW_SN_CRB_AGT_ADR)
328#define QLA82XX_HW_CRB_HUB_AGT_ADR_I2Q ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
329 QLA82XX_HW_I2Q_CRB_AGT_ADR)
330#define QLA82XX_HW_CRB_HUB_AGT_ADR_ROMUSB ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
331 QLA82XX_HW_ROMUSB_CRB_AGT_ADR)
332#define QLA82XX_HW_CRB_HUB_AGT_ADR_OCM0 ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
333 QLA82XX_HW_OCM0_CRB_AGT_ADR)
334#define QLA82XX_HW_CRB_HUB_AGT_ADR_OCM1 ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
335 QLA82XX_HW_OCM1_CRB_AGT_ADR)
336#define QLA82XX_HW_CRB_HUB_AGT_ADR_LPC ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
337 QLA82XX_HW_LPC_CRB_AGT_ADR)
338
339#define ROMUSB_GLB (QLA82XX_CRB_ROMUSB + 0x00000)
340#define QLA82XX_ROMUSB_GLB_PEGTUNE_DONE (ROMUSB_GLB + 0x005c)
341#define QLA82XX_ROMUSB_GLB_STATUS (ROMUSB_GLB + 0x0004)
342#define QLA82XX_ROMUSB_GLB_SW_RESET (ROMUSB_GLB + 0x0008)
343#define QLA82XX_ROMUSB_ROM_ADDRESS (ROMUSB_ROM + 0x0008)
344#define QLA82XX_ROMUSB_ROM_WDATA (ROMUSB_ROM + 0x000c)
345#define QLA82XX_ROMUSB_ROM_ABYTE_CNT (ROMUSB_ROM + 0x0010)
346#define QLA82XX_ROMUSB_ROM_DUMMY_BYTE_CNT (ROMUSB_ROM + 0x0014)
347#define QLA82XX_ROMUSB_ROM_RDATA (ROMUSB_ROM + 0x0018)
348
349#define ROMUSB_ROM (QLA82XX_CRB_ROMUSB + 0x10000)
350#define QLA82XX_ROMUSB_ROM_INSTR_OPCODE (ROMUSB_ROM + 0x0004)
351#define QLA82XX_ROMUSB_GLB_CAS_RST (ROMUSB_GLB + 0x0038)
352
353/* Lock IDs for ROM lock */
354#define ROM_LOCK_DRIVER 0x0d417340
355
356#define QLA82XX_PCI_CRB_WINDOWSIZE 0x00100000 /* all are 1MB windows */
357#define QLA82XX_PCI_CRB_WINDOW(A) (QLA82XX_PCI_CRBSPACE + \
358 (A)*QLA82XX_PCI_CRB_WINDOWSIZE)
359
360#define QLA82XX_CRB_C2C_0 \
361 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C0)
362#define QLA82XX_CRB_C2C_1 \
363 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C1)
364#define QLA82XX_CRB_C2C_2 \
365 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C2)
366#define QLA82XX_CRB_CAM \
367 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAM)
368#define QLA82XX_CRB_CASPER \
369 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS)
370#define QLA82XX_CRB_CASPER_0 \
371 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS0)
372#define QLA82XX_CRB_CASPER_1 \
373 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS1)
374#define QLA82XX_CRB_CASPER_2 \
375 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS2)
376#define QLA82XX_CRB_DDR_MD \
377 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_MS)
378#define QLA82XX_CRB_DDR_NET \
379 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_MN)
380#define QLA82XX_CRB_EPG \
381 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_EG)
382#define QLA82XX_CRB_I2Q \
383 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2Q)
384#define QLA82XX_CRB_NIU \
385 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_NIU)
386/* HACK upon HACK upon HACK (for PCIE builds) */
387#define QLA82XX_CRB_PCIX_HOST \
388 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PH)
389#define QLA82XX_CRB_PCIX_HOST2 \
390 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PH2)
391#define QLA82XX_CRB_PCIX_MD \
392 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PS)
393#define QLA82XX_CRB_PCIE QLA82XX_CRB_PCIX_MD
394/* window 1 pcie slot */
395#define QLA82XX_CRB_PCIE2 \
396 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PS2)
397
398#define QLA82XX_CRB_PEG_MD_0 \
399 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS0)
400#define QLA82XX_CRB_PEG_MD_1 \
401 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS1)
402#define QLA82XX_CRB_PEG_MD_2 \
403 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS2)
404#define QLA82XX_CRB_PEG_MD_3 \
405 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS3)
406#define QLA82XX_CRB_PEG_MD_3 \
407 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS3)
408#define QLA82XX_CRB_PEG_MD_D \
409 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGSD)
410#define QLA82XX_CRB_PEG_MD_I \
411 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGSI)
412#define QLA82XX_CRB_PEG_NET_0 \
413 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN0)
414#define QLA82XX_CRB_PEG_NET_1 \
415 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN1)
416#define QLA82XX_CRB_PEG_NET_2 \
417 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN2)
418#define QLA82XX_CRB_PEG_NET_3 \
419 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN3)
420#define QLA82XX_CRB_PEG_NET_4 \
421 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN4)
422#define QLA82XX_CRB_PEG_NET_D \
423 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGND)
424#define QLA82XX_CRB_PEG_NET_I \
425 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGNI)
426#define QLA82XX_CRB_PQM_MD \
427 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_QMS)
428#define QLA82XX_CRB_PQM_NET \
429 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_QMN)
430#define QLA82XX_CRB_QDR_MD \
431 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SS)
432#define QLA82XX_CRB_QDR_NET \
433 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SN)
434#define QLA82XX_CRB_ROMUSB \
435 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_ROMUSB)
436#define QLA82XX_CRB_RPMX_0 \
437 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX0)
438#define QLA82XX_CRB_RPMX_1 \
439 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX1)
440#define QLA82XX_CRB_RPMX_2 \
441 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX2)
442#define QLA82XX_CRB_RPMX_3 \
443 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX3)
444#define QLA82XX_CRB_RPMX_4 \
445 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX4)
446#define QLA82XX_CRB_RPMX_5 \
447 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX5)
448#define QLA82XX_CRB_RPMX_6 \
449 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX6)
450#define QLA82XX_CRB_RPMX_7 \
451 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX7)
452#define QLA82XX_CRB_SQM_MD_0 \
453 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS0)
454#define QLA82XX_CRB_SQM_MD_1 \
455 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS1)
456#define QLA82XX_CRB_SQM_MD_2 \
457 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS2)
458#define QLA82XX_CRB_SQM_MD_3 \
459 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS3)
460#define QLA82XX_CRB_SQM_NET_0 \
461 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN0)
462#define QLA82XX_CRB_SQM_NET_1 \
463 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN1)
464#define QLA82XX_CRB_SQM_NET_2 \
465 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN2)
466#define QLA82XX_CRB_SQM_NET_3 \
467 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN3)
468#define QLA82XX_CRB_SRE \
469 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SRE)
470#define QLA82XX_CRB_TIMER \
471 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_TIMR)
472#define QLA82XX_CRB_XDMA \
473 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_XDMA)
474#define QLA82XX_CRB_I2C0 \
475 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2C0)
476#define QLA82XX_CRB_I2C1 \
477 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2C1)
478#define QLA82XX_CRB_OCM0 \
479 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_OCM0)
480#define QLA82XX_CRB_SMB \
481 QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SMB)
482
483#define QLA82XX_CRB_MAX QLA82XX_PCI_CRB_WINDOW(64)
484
485/*
486 * ====================== BASE ADDRESSES ON-CHIP ======================
487 * Base addresses of major components on-chip.
488 * ====================== BASE ADDRESSES ON-CHIP ======================
489 */
490#define QLA82XX_ADDR_DDR_NET (0x0000000000000000ULL)
491#define QLA82XX_ADDR_DDR_NET_MAX (0x000000000fffffffULL)
492
493/* Imbus address bit used to indicate a host address. This bit is
494 * eliminated by the pcie bar and bar select before presentation
495 * over pcie. */
496/* host memory via IMBUS */
497#define QLA82XX_P2_ADDR_PCIE (0x0000000800000000ULL)
498#define QLA82XX_P3_ADDR_PCIE (0x0000008000000000ULL)
499#define QLA82XX_ADDR_PCIE_MAX (0x0000000FFFFFFFFFULL)
500#define QLA82XX_ADDR_OCM0 (0x0000000200000000ULL)
501#define QLA82XX_ADDR_OCM0_MAX (0x00000002000fffffULL)
502#define QLA82XX_ADDR_OCM1 (0x0000000200400000ULL)
503#define QLA82XX_ADDR_OCM1_MAX (0x00000002004fffffULL)
504#define QLA82XX_ADDR_QDR_NET (0x0000000300000000ULL)
505
506#define QLA82XX_P2_ADDR_QDR_NET_MAX (0x00000003001fffffULL)
507#define QLA82XX_P3_ADDR_QDR_NET_MAX (0x0000000303ffffffULL)
508
509#define QLA82XX_PCI_CRBSPACE (unsigned long)0x06000000
510#define QLA82XX_PCI_DIRECT_CRB (unsigned long)0x04400000
511#define QLA82XX_PCI_CAMQM (unsigned long)0x04800000
512#define QLA82XX_PCI_CAMQM_MAX (unsigned long)0x04ffffff
513#define QLA82XX_PCI_DDR_NET (unsigned long)0x00000000
514#define QLA82XX_PCI_QDR_NET (unsigned long)0x04000000
515#define QLA82XX_PCI_QDR_NET_MAX (unsigned long)0x043fffff
516
517/*
518 * Register offsets for MN
519 */
520#define MIU_CONTROL (0x000)
521#define MIU_TAG (0x004)
522#define MIU_TEST_AGT_CTRL (0x090)
523#define MIU_TEST_AGT_ADDR_LO (0x094)
524#define MIU_TEST_AGT_ADDR_HI (0x098)
525#define MIU_TEST_AGT_WRDATA_LO (0x0a0)
526#define MIU_TEST_AGT_WRDATA_HI (0x0a4)
527#define MIU_TEST_AGT_WRDATA(i) (0x0a0+(4*(i)))
528#define MIU_TEST_AGT_RDDATA_LO (0x0a8)
529#define MIU_TEST_AGT_RDDATA_HI (0x0ac)
530#define MIU_TEST_AGT_RDDATA(i) (0x0a8+(4*(i)))
531#define MIU_TEST_AGT_ADDR_MASK 0xfffffff8
532#define MIU_TEST_AGT_UPPER_ADDR(off) (0)
533
534/* MIU_TEST_AGT_CTRL flags. work for SIU as well */
535#define MIU_TA_CTL_START 1
536#define MIU_TA_CTL_ENABLE 2
537#define MIU_TA_CTL_WRITE 4
538#define MIU_TA_CTL_BUSY 8
539
540/*CAM RAM */
541# define QLA82XX_CAM_RAM_BASE (QLA82XX_CRB_CAM + 0x02000)
542# define QLA82XX_CAM_RAM(reg) (QLA82XX_CAM_RAM_BASE + (reg))
543
Vikas Chaudharyf4f5df22010-07-28 15:53:44 +0530544#define QLA82XX_PORT_MODE_ADDR (QLA82XX_CAM_RAM(0x24))
545#define QLA82XX_PEG_HALT_STATUS1 (QLA82XX_CAM_RAM(0xa8))
546#define QLA82XX_PEG_HALT_STATUS2 (QLA82XX_CAM_RAM(0xac))
547#define QLA82XX_PEG_ALIVE_COUNTER (QLA82XX_CAM_RAM(0xb0))
Shyam Sundar2657c802010-10-06 22:50:29 -0700548#define QLA82XX_CAM_RAM_DB1 (QLA82XX_CAM_RAM(0x1b0))
549#define QLA82XX_CAM_RAM_DB2 (QLA82XX_CAM_RAM(0x1b4))
Vikas Chaudharyf4f5df22010-07-28 15:53:44 +0530550
551#define HALT_STATUS_UNRECOVERABLE 0x80000000
552#define HALT_STATUS_RECOVERABLE 0x40000000
553
554
555#define QLA82XX_ROM_LOCK_ID (QLA82XX_CAM_RAM(0x100))
556#define QLA82XX_CRB_WIN_LOCK_ID (QLA82XX_CAM_RAM(0x124))
557#define QLA82XX_FW_VERSION_MAJOR (QLA82XX_CAM_RAM(0x150))
558#define QLA82XX_FW_VERSION_MINOR (QLA82XX_CAM_RAM(0x154))
559#define QLA82XX_FW_VERSION_SUB (QLA82XX_CAM_RAM(0x158))
560#define QLA82XX_PCIE_REG(reg) (QLA82XX_CRB_PCIE + (reg))
561
562/* Driver Coexistence Defines */
563#define QLA82XX_CRB_DRV_ACTIVE (QLA82XX_CAM_RAM(0x138))
564#define QLA82XX_CRB_DEV_STATE (QLA82XX_CAM_RAM(0x140))
565#define QLA82XX_CRB_DEV_PART_INFO (QLA82XX_CAM_RAM(0x14c))
566#define QLA82XX_CRB_DRV_IDC_VERSION (QLA82XX_CAM_RAM(0x174))
567#define QLA82XX_CRB_DRV_STATE (QLA82XX_CAM_RAM(0x144))
568#define QLA82XX_CRB_DRV_SCRATCH (QLA82XX_CAM_RAM(0x148))
569#define QLA82XX_CRB_DEV_PART_INFO (QLA82XX_CAM_RAM(0x14c))
570
571/* Every driver should use these Device State */
572#define QLA82XX_DEV_COLD 1
573#define QLA82XX_DEV_INITIALIZING 2
574#define QLA82XX_DEV_READY 3
575#define QLA82XX_DEV_NEED_RESET 4
576#define QLA82XX_DEV_NEED_QUIESCENT 5
577#define QLA82XX_DEV_FAILED 6
578#define QLA82XX_DEV_QUIESCENT 7
579#define MAX_STATES 8 /* Increment if new state added */
580
581#define QLA82XX_IDC_VERSION 0x1
582#define ROM_DEV_INIT_TIMEOUT 30
583#define ROM_DRV_RESET_ACK_TIMEOUT 10
584
585#define PCIE_SETUP_FUNCTION (0x12040)
586#define PCIE_SETUP_FUNCTION2 (0x12048)
587
588#define QLA82XX_PCIX_PS_REG(reg) (QLA82XX_CRB_PCIX_MD + (reg))
589#define QLA82XX_PCIX_PS2_REG(reg) (QLA82XX_CRB_PCIE2 + (reg))
590
591#define PCIE_SEM2_LOCK (0x1c010) /* Flash lock */
592#define PCIE_SEM2_UNLOCK (0x1c014) /* Flash unlock */
593#define PCIE_SEM5_LOCK (0x1c028) /* Coexistence lock */
594#define PCIE_SEM5_UNLOCK (0x1c02c) /* Coexistence unlock */
595#define PCIE_SEM7_LOCK (0x1c038) /* crb win lock */
596#define PCIE_SEM7_UNLOCK (0x1c03c) /* crbwin unlock*/
597
598/*
599 * The PCI VendorID and DeviceID for our board.
600 */
601#define QLA82XX_MSIX_TBL_SPACE 8192
602#define QLA82XX_PCI_REG_MSIX_TBL 0x44
603#define QLA82XX_PCI_MSIX_CONTROL 0x40
604
605struct crb_128M_2M_sub_block_map {
606 unsigned valid;
607 unsigned start_128M;
608 unsigned end_128M;
609 unsigned start_2M;
610};
611
612struct crb_128M_2M_block_map {
613 struct crb_128M_2M_sub_block_map sub_block[16];
614};
615
616struct crb_addr_pair {
617 long addr;
618 long data;
619};
620
621#define ADDR_ERROR ((unsigned long) 0xffffffff)
622#define MAX_CTL_CHECK 1000
623
624/***************************************************************************
625 * PCI related defines.
626 **************************************************************************/
627
628/*
629 * Interrupt related defines.
630 */
631#define PCIX_TARGET_STATUS (0x10118)
632#define PCIX_TARGET_STATUS_F1 (0x10160)
633#define PCIX_TARGET_STATUS_F2 (0x10164)
634#define PCIX_TARGET_STATUS_F3 (0x10168)
635#define PCIX_TARGET_STATUS_F4 (0x10360)
636#define PCIX_TARGET_STATUS_F5 (0x10364)
637#define PCIX_TARGET_STATUS_F6 (0x10368)
638#define PCIX_TARGET_STATUS_F7 (0x1036c)
639
640#define PCIX_TARGET_MASK (0x10128)
641#define PCIX_TARGET_MASK_F1 (0x10170)
642#define PCIX_TARGET_MASK_F2 (0x10174)
643#define PCIX_TARGET_MASK_F3 (0x10178)
644#define PCIX_TARGET_MASK_F4 (0x10370)
645#define PCIX_TARGET_MASK_F5 (0x10374)
646#define PCIX_TARGET_MASK_F6 (0x10378)
647#define PCIX_TARGET_MASK_F7 (0x1037c)
648
649/*
650 * Message Signaled Interrupts
651 */
652#define PCIX_MSI_F0 (0x13000)
653#define PCIX_MSI_F1 (0x13004)
654#define PCIX_MSI_F2 (0x13008)
655#define PCIX_MSI_F3 (0x1300c)
656#define PCIX_MSI_F4 (0x13010)
657#define PCIX_MSI_F5 (0x13014)
658#define PCIX_MSI_F6 (0x13018)
659#define PCIX_MSI_F7 (0x1301c)
660#define PCIX_MSI_F(FUNC) (0x13000 + ((FUNC) * 4))
661
662/*
663 *
664 */
665#define PCIX_INT_VECTOR (0x10100)
666#define PCIX_INT_MASK (0x10104)
667
668/*
669 * Interrupt state machine and other bits.
670 */
671#define PCIE_MISCCFG_RC (0x1206c)
672
673
674#define ISR_INT_TARGET_STATUS \
675 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS))
676#define ISR_INT_TARGET_STATUS_F1 \
677 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F1))
678#define ISR_INT_TARGET_STATUS_F2 \
679 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F2))
680#define ISR_INT_TARGET_STATUS_F3 \
681 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F3))
682#define ISR_INT_TARGET_STATUS_F4 \
683 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F4))
684#define ISR_INT_TARGET_STATUS_F5 \
685 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F5))
686#define ISR_INT_TARGET_STATUS_F6 \
687 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F6))
688#define ISR_INT_TARGET_STATUS_F7 \
689 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F7))
690
691#define ISR_INT_TARGET_MASK \
692 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK))
693#define ISR_INT_TARGET_MASK_F1 \
694 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F1))
695#define ISR_INT_TARGET_MASK_F2 \
696 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F2))
697#define ISR_INT_TARGET_MASK_F3 \
698 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F3))
699#define ISR_INT_TARGET_MASK_F4 \
700 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F4))
701#define ISR_INT_TARGET_MASK_F5 \
702 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F5))
703#define ISR_INT_TARGET_MASK_F6 \
704 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F6))
705#define ISR_INT_TARGET_MASK_F7 \
706 (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F7))
707
708#define ISR_INT_VECTOR (QLA82XX_PCIX_PS_REG(PCIX_INT_VECTOR))
709#define ISR_INT_MASK (QLA82XX_PCIX_PS_REG(PCIX_INT_MASK))
710#define ISR_INT_STATE_REG (QLA82XX_PCIX_PS_REG(PCIE_MISCCFG_RC))
711
712#define ISR_MSI_INT_TRIGGER(FUNC) (QLA82XX_PCIX_PS_REG(PCIX_MSI_F(FUNC)))
713
714
715#define ISR_IS_LEGACY_INTR_IDLE(VAL) (((VAL) & 0x300) == 0)
716#define ISR_IS_LEGACY_INTR_TRIGGERED(VAL) (((VAL) & 0x300) == 0x200)
717
718/*
719 * PCI Interrupt Vector Values.
720 */
721#define PCIX_INT_VECTOR_BIT_F0 0x0080
722#define PCIX_INT_VECTOR_BIT_F1 0x0100
723#define PCIX_INT_VECTOR_BIT_F2 0x0200
724#define PCIX_INT_VECTOR_BIT_F3 0x0400
725#define PCIX_INT_VECTOR_BIT_F4 0x0800
726#define PCIX_INT_VECTOR_BIT_F5 0x1000
727#define PCIX_INT_VECTOR_BIT_F6 0x2000
728#define PCIX_INT_VECTOR_BIT_F7 0x4000
729
730/* struct qla4_8xxx_legacy_intr_set defined in ql4_def.h */
731
732#define QLA82XX_LEGACY_INTR_CONFIG \
733{ \
734 { \
735 .int_vec_bit = PCIX_INT_VECTOR_BIT_F0, \
736 .tgt_status_reg = ISR_INT_TARGET_STATUS, \
737 .tgt_mask_reg = ISR_INT_TARGET_MASK, \
738 .pci_int_reg = ISR_MSI_INT_TRIGGER(0) }, \
739 \
740 { \
741 .int_vec_bit = PCIX_INT_VECTOR_BIT_F1, \
742 .tgt_status_reg = ISR_INT_TARGET_STATUS_F1, \
743 .tgt_mask_reg = ISR_INT_TARGET_MASK_F1, \
744 .pci_int_reg = ISR_MSI_INT_TRIGGER(1) }, \
745 \
746 { \
747 .int_vec_bit = PCIX_INT_VECTOR_BIT_F2, \
748 .tgt_status_reg = ISR_INT_TARGET_STATUS_F2, \
749 .tgt_mask_reg = ISR_INT_TARGET_MASK_F2, \
750 .pci_int_reg = ISR_MSI_INT_TRIGGER(2) }, \
751 \
752 { \
753 .int_vec_bit = PCIX_INT_VECTOR_BIT_F3, \
754 .tgt_status_reg = ISR_INT_TARGET_STATUS_F3, \
755 .tgt_mask_reg = ISR_INT_TARGET_MASK_F3, \
756 .pci_int_reg = ISR_MSI_INT_TRIGGER(3) }, \
757 \
758 { \
759 .int_vec_bit = PCIX_INT_VECTOR_BIT_F4, \
760 .tgt_status_reg = ISR_INT_TARGET_STATUS_F4, \
761 .tgt_mask_reg = ISR_INT_TARGET_MASK_F4, \
762 .pci_int_reg = ISR_MSI_INT_TRIGGER(4) }, \
763 \
764 { \
765 .int_vec_bit = PCIX_INT_VECTOR_BIT_F5, \
766 .tgt_status_reg = ISR_INT_TARGET_STATUS_F5, \
767 .tgt_mask_reg = ISR_INT_TARGET_MASK_F5, \
768 .pci_int_reg = ISR_MSI_INT_TRIGGER(5) }, \
769 \
770 { \
771 .int_vec_bit = PCIX_INT_VECTOR_BIT_F6, \
772 .tgt_status_reg = ISR_INT_TARGET_STATUS_F6, \
773 .tgt_mask_reg = ISR_INT_TARGET_MASK_F6, \
774 .pci_int_reg = ISR_MSI_INT_TRIGGER(6) }, \
775 \
776 { \
777 .int_vec_bit = PCIX_INT_VECTOR_BIT_F7, \
778 .tgt_status_reg = ISR_INT_TARGET_STATUS_F7, \
779 .tgt_mask_reg = ISR_INT_TARGET_MASK_F7, \
780 .pci_int_reg = ISR_MSI_INT_TRIGGER(7) }, \
781}
782
783/* Magic number to let user know flash is programmed */
784#define QLA82XX_BDINFO_MAGIC 0x12345678
785#define FW_SIZE_OFFSET (0x3e840c)
786
787/* QLA82XX additions */
788#define MIU_TEST_AGT_WRDATA_UPPER_LO (0x0b0)
789#define MIU_TEST_AGT_WRDATA_UPPER_HI (0x0b4)
790
791#endif