xref: /openbmc/linux/drivers/scsi/qla2xxx/qla_nx.h (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
177adf3f0SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2a9083016SGiridhar Malavali /*
3a9083016SGiridhar Malavali  * QLogic Fibre Channel HBA Driver
4bd21eaf9SArmen Baloyan  * Copyright (c)  2003-2014 QLogic Corporation
5a9083016SGiridhar Malavali  */
6a9083016SGiridhar Malavali #ifndef __QLA_NX_H
7a9083016SGiridhar Malavali #define __QLA_NX_H
8a9083016SGiridhar Malavali 
99dfb59a0SBart Van Assche #include <scsi/scsi.h>
1052eacd61SCorentin Labbe 
11a9083016SGiridhar Malavali /*
12a9083016SGiridhar Malavali  * Following are the states of the Phantom. Phantom will set them and
13a9083016SGiridhar Malavali  * Host will read to check if the fields are correct.
14a9083016SGiridhar Malavali */
15a9083016SGiridhar Malavali #define PHAN_INITIALIZE_FAILED	      0xffff
16a9083016SGiridhar Malavali #define PHAN_INITIALIZE_COMPLETE      0xff01
17a9083016SGiridhar Malavali 
18a9083016SGiridhar Malavali /* Host writes the following to notify that it has done the init-handshake */
19a9083016SGiridhar Malavali #define PHAN_INITIALIZE_ACK	      0xf00f
20a9083016SGiridhar Malavali #define PHAN_PEG_RCV_INITIALIZED      0xff01
21a9083016SGiridhar Malavali 
22a9083016SGiridhar Malavali /*CRB_RELATED*/
23a9083016SGiridhar Malavali #define QLA82XX_CRB_BASE	QLA82XX_CAM_RAM(0x200)
24a9083016SGiridhar Malavali #define QLA82XX_REG(X)		(QLA82XX_CRB_BASE+(X))
25a9083016SGiridhar Malavali 
26a9083016SGiridhar Malavali #define CRB_CMDPEG_STATE		QLA82XX_REG(0x50)
27a9083016SGiridhar Malavali #define CRB_RCVPEG_STATE		QLA82XX_REG(0x13c)
28a9083016SGiridhar Malavali #define BOOT_LOADER_DIMM_STATUS		QLA82XX_REG(0x54)
29a9083016SGiridhar Malavali #define CRB_DMA_SHIFT			QLA82XX_REG(0xcc)
305988aeb2SGiridhar Malavali #define CRB_TEMP_STATE			QLA82XX_REG(0x1b4)
3177e334d2SGiridhar Malavali #define QLA82XX_DMA_SHIFT_VALUE		0x55555555
32a9083016SGiridhar Malavali 
33a9083016SGiridhar Malavali #define QLA82XX_HW_H0_CH_HUB_ADR    0x05
34a9083016SGiridhar Malavali #define QLA82XX_HW_H1_CH_HUB_ADR    0x0E
35a9083016SGiridhar Malavali #define QLA82XX_HW_H2_CH_HUB_ADR    0x03
36a9083016SGiridhar Malavali #define QLA82XX_HW_H3_CH_HUB_ADR    0x01
37a9083016SGiridhar Malavali #define QLA82XX_HW_H4_CH_HUB_ADR    0x06
38a9083016SGiridhar Malavali #define QLA82XX_HW_H5_CH_HUB_ADR    0x07
39a9083016SGiridhar Malavali #define QLA82XX_HW_H6_CH_HUB_ADR    0x08
40a9083016SGiridhar Malavali 
41a9083016SGiridhar Malavali /*  Hub 0 */
42a9083016SGiridhar Malavali #define QLA82XX_HW_MN_CRB_AGT_ADR   0x15
43a9083016SGiridhar Malavali #define QLA82XX_HW_MS_CRB_AGT_ADR   0x25
44a9083016SGiridhar Malavali 
45a9083016SGiridhar Malavali /*  Hub 1 */
46a9083016SGiridhar Malavali #define QLA82XX_HW_PS_CRB_AGT_ADR	0x73
47a9083016SGiridhar Malavali #define QLA82XX_HW_QMS_CRB_AGT_ADR	0x00
48a9083016SGiridhar Malavali #define QLA82XX_HW_RPMX3_CRB_AGT_ADR	0x0b
49a9083016SGiridhar Malavali #define QLA82XX_HW_SQGS0_CRB_AGT_ADR	0x01
50a9083016SGiridhar Malavali #define QLA82XX_HW_SQGS1_CRB_AGT_ADR	0x02
51a9083016SGiridhar Malavali #define QLA82XX_HW_SQGS2_CRB_AGT_ADR	0x03
52a9083016SGiridhar Malavali #define QLA82XX_HW_SQGS3_CRB_AGT_ADR	0x04
53a9083016SGiridhar Malavali #define QLA82XX_HW_C2C0_CRB_AGT_ADR	0x58
54a9083016SGiridhar Malavali #define QLA82XX_HW_C2C1_CRB_AGT_ADR	0x59
55a9083016SGiridhar Malavali #define QLA82XX_HW_C2C2_CRB_AGT_ADR	0x5a
56a9083016SGiridhar Malavali #define QLA82XX_HW_RPMX2_CRB_AGT_ADR	0x0a
57a9083016SGiridhar Malavali #define QLA82XX_HW_RPMX4_CRB_AGT_ADR	0x0c
58a9083016SGiridhar Malavali #define QLA82XX_HW_RPMX7_CRB_AGT_ADR	0x0f
59a9083016SGiridhar Malavali #define QLA82XX_HW_RPMX9_CRB_AGT_ADR	0x12
60a9083016SGiridhar Malavali #define QLA82XX_HW_SMB_CRB_AGT_ADR	0x18
61a9083016SGiridhar Malavali 
62a9083016SGiridhar Malavali /*  Hub 2 */
63a9083016SGiridhar Malavali #define QLA82XX_HW_NIU_CRB_AGT_ADR	0x31
64a9083016SGiridhar Malavali #define QLA82XX_HW_I2C0_CRB_AGT_ADR	0x19
65a9083016SGiridhar Malavali #define QLA82XX_HW_I2C1_CRB_AGT_ADR	0x29
66a9083016SGiridhar Malavali 
67a9083016SGiridhar Malavali #define QLA82XX_HW_SN_CRB_AGT_ADR	0x10
68a9083016SGiridhar Malavali #define QLA82XX_HW_I2Q_CRB_AGT_ADR	0x20
69a9083016SGiridhar Malavali #define QLA82XX_HW_LPC_CRB_AGT_ADR	0x22
70a9083016SGiridhar Malavali #define QLA82XX_HW_ROMUSB_CRB_AGT_ADR	0x21
71a9083016SGiridhar Malavali #define QLA82XX_HW_QM_CRB_AGT_ADR	0x66
72a9083016SGiridhar Malavali #define QLA82XX_HW_SQG0_CRB_AGT_ADR	0x60
73a9083016SGiridhar Malavali #define QLA82XX_HW_SQG1_CRB_AGT_ADR	0x61
74a9083016SGiridhar Malavali #define QLA82XX_HW_SQG2_CRB_AGT_ADR	0x62
75a9083016SGiridhar Malavali #define QLA82XX_HW_SQG3_CRB_AGT_ADR	0x63
76a9083016SGiridhar Malavali #define QLA82XX_HW_RPMX1_CRB_AGT_ADR	0x09
77a9083016SGiridhar Malavali #define QLA82XX_HW_RPMX5_CRB_AGT_ADR	0x0d
78a9083016SGiridhar Malavali #define QLA82XX_HW_RPMX6_CRB_AGT_ADR	0x0e
79a9083016SGiridhar Malavali #define QLA82XX_HW_RPMX8_CRB_AGT_ADR	0x11
80a9083016SGiridhar Malavali 
81a9083016SGiridhar Malavali /*  Hub 3 */
82a9083016SGiridhar Malavali #define QLA82XX_HW_PH_CRB_AGT_ADR	0x1A
83a9083016SGiridhar Malavali #define QLA82XX_HW_SRE_CRB_AGT_ADR	0x50
84a9083016SGiridhar Malavali #define QLA82XX_HW_EG_CRB_AGT_ADR	0x51
85a9083016SGiridhar Malavali #define QLA82XX_HW_RPMX0_CRB_AGT_ADR	0x08
86a9083016SGiridhar Malavali 
87a9083016SGiridhar Malavali /*  Hub 4 */
88a9083016SGiridhar Malavali #define QLA82XX_HW_PEGN0_CRB_AGT_ADR	0x40
89a9083016SGiridhar Malavali #define QLA82XX_HW_PEGN1_CRB_AGT_ADR	0x41
90a9083016SGiridhar Malavali #define QLA82XX_HW_PEGN2_CRB_AGT_ADR	0x42
91a9083016SGiridhar Malavali #define QLA82XX_HW_PEGN3_CRB_AGT_ADR	0x43
92a9083016SGiridhar Malavali #define QLA82XX_HW_PEGNI_CRB_AGT_ADR	0x44
93a9083016SGiridhar Malavali #define QLA82XX_HW_PEGND_CRB_AGT_ADR	0x45
94a9083016SGiridhar Malavali #define QLA82XX_HW_PEGNC_CRB_AGT_ADR	0x46
95a9083016SGiridhar Malavali #define QLA82XX_HW_PEGR0_CRB_AGT_ADR	0x47
96a9083016SGiridhar Malavali #define QLA82XX_HW_PEGR1_CRB_AGT_ADR	0x48
97a9083016SGiridhar Malavali #define QLA82XX_HW_PEGR2_CRB_AGT_ADR	0x49
98a9083016SGiridhar Malavali #define QLA82XX_HW_PEGR3_CRB_AGT_ADR	0x4a
99a9083016SGiridhar Malavali #define QLA82XX_HW_PEGN4_CRB_AGT_ADR	0x4b
100a9083016SGiridhar Malavali 
101a9083016SGiridhar Malavali /*  Hub 5 */
102a9083016SGiridhar Malavali #define QLA82XX_HW_PEGS0_CRB_AGT_ADR	0x40
103a9083016SGiridhar Malavali #define QLA82XX_HW_PEGS1_CRB_AGT_ADR	0x41
104a9083016SGiridhar Malavali #define QLA82XX_HW_PEGS2_CRB_AGT_ADR	0x42
105a9083016SGiridhar Malavali #define QLA82XX_HW_PEGS3_CRB_AGT_ADR	0x43
106a9083016SGiridhar Malavali #define QLA82XX_HW_PEGSI_CRB_AGT_ADR	0x44
107a9083016SGiridhar Malavali #define QLA82XX_HW_PEGSD_CRB_AGT_ADR	0x45
108a9083016SGiridhar Malavali #define QLA82XX_HW_PEGSC_CRB_AGT_ADR	0x46
109a9083016SGiridhar Malavali 
110a9083016SGiridhar Malavali /*  Hub 6 */
111a9083016SGiridhar Malavali #define QLA82XX_HW_CAS0_CRB_AGT_ADR	0x46
112a9083016SGiridhar Malavali #define QLA82XX_HW_CAS1_CRB_AGT_ADR	0x47
113a9083016SGiridhar Malavali #define QLA82XX_HW_CAS2_CRB_AGT_ADR	0x48
114a9083016SGiridhar Malavali #define QLA82XX_HW_CAS3_CRB_AGT_ADR	0x49
115a9083016SGiridhar Malavali #define QLA82XX_HW_NCM_CRB_AGT_ADR	0x16
116a9083016SGiridhar Malavali #define QLA82XX_HW_TMR_CRB_AGT_ADR	0x17
117a9083016SGiridhar Malavali #define QLA82XX_HW_XDMA_CRB_AGT_ADR	0x05
118a9083016SGiridhar Malavali #define QLA82XX_HW_OCM0_CRB_AGT_ADR	0x06
119a9083016SGiridhar Malavali #define QLA82XX_HW_OCM1_CRB_AGT_ADR	0x07
120a9083016SGiridhar Malavali 
121a9083016SGiridhar Malavali /*  This field defines PCI/X adr [25:20] of agents on the CRB */
122a9083016SGiridhar Malavali /*  */
123a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PH	0
124a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PS	1
125a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_MN	2
126a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_MS	3
127a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SRE	5
128a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_NIU	6
129a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_QMN	7
130a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SQN0	8
131a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SQN1	9
132a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SQN2	10
133a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SQN3	11
134a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_QMS	12
135a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SQS0	13
136a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SQS1	14
137a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SQS2	15
138a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SQS3	16
139a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGN0	17
140a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGN1	18
141a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGN2	19
142a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGN3	20
143a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGN4	QLA82XX_HW_PX_MAP_CRB_SQS2
144a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGND	21
145a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGNI	22
146a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGS0	23
147a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGS1	24
148a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGS2	25
149a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGS3	26
150a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGSD	27
151a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGSI	28
152a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SN	29
153a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_EG	31
154a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PH2	32
155a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PS2	33
156a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_CAM	34
157a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_CAS0	35
158a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_CAS1	36
159a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_CAS2	37
160a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_C2C0	38
161a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_C2C1	39
162a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_TIMR	40
163a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_RPMX1	42
164a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_RPMX2	43
165a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_RPMX3	44
166a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_RPMX4	45
167a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_RPMX5	46
168a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_RPMX6	47
169a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_RPMX7	48
170a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_XDMA	49
171a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_I2Q	50
172a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_ROMUSB	51
173a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_CAS3	52
174a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_RPMX0	53
175a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_RPMX8	54
176a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_RPMX9	55
177a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_OCM0	56
178a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_OCM1	57
179a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_SMB	58
180a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_I2C0	59
181a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_I2C1	60
182a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_LPC	61
183a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGNC	62
184a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGR0	63
185a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGR1	4
186a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGR2	30
187a9083016SGiridhar Malavali #define QLA82XX_HW_PX_MAP_CRB_PGR3	41
188a9083016SGiridhar Malavali 
189a9083016SGiridhar Malavali /*  This field defines CRB adr [31:20] of the agents */
190a9083016SGiridhar Malavali /*  */
191a9083016SGiridhar Malavali 
192a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_MN	    ((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
193a9083016SGiridhar Malavali 	QLA82XX_HW_MN_CRB_AGT_ADR)
194a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PH	    ((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
195a9083016SGiridhar Malavali 	QLA82XX_HW_PH_CRB_AGT_ADR)
196a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_MS	    ((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
197a9083016SGiridhar Malavali 	QLA82XX_HW_MS_CRB_AGT_ADR)
198a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PS	    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
199a9083016SGiridhar Malavali 	QLA82XX_HW_PS_CRB_AGT_ADR)
200a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SS	    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
201a9083016SGiridhar Malavali 	QLA82XX_HW_SS_CRB_AGT_ADR)
202a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX3    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
203a9083016SGiridhar Malavali 	QLA82XX_HW_RPMX3_CRB_AGT_ADR)
204a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_QMS	    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
205a9083016SGiridhar Malavali 	QLA82XX_HW_QMS_CRB_AGT_ADR)
206a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS0     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
207a9083016SGiridhar Malavali 	QLA82XX_HW_SQGS0_CRB_AGT_ADR)
208a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS1     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
209a9083016SGiridhar Malavali 	QLA82XX_HW_SQGS1_CRB_AGT_ADR)
210a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS2     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
211a9083016SGiridhar Malavali 	QLA82XX_HW_SQGS2_CRB_AGT_ADR)
212a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS3     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
213a9083016SGiridhar Malavali 	QLA82XX_HW_SQGS3_CRB_AGT_ADR)
214a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_C2C0     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
215a9083016SGiridhar Malavali 	QLA82XX_HW_C2C0_CRB_AGT_ADR)
216a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_C2C1     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
217a9083016SGiridhar Malavali 	QLA82XX_HW_C2C1_CRB_AGT_ADR)
218a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX2    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
219a9083016SGiridhar Malavali 	QLA82XX_HW_RPMX2_CRB_AGT_ADR)
220a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX4    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
221a9083016SGiridhar Malavali 	QLA82XX_HW_RPMX4_CRB_AGT_ADR)
222a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX7    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
223a9083016SGiridhar Malavali 	QLA82XX_HW_RPMX7_CRB_AGT_ADR)
224a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX9    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
225a9083016SGiridhar Malavali 	QLA82XX_HW_RPMX9_CRB_AGT_ADR)
226a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SMB	    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
227a9083016SGiridhar Malavali 	QLA82XX_HW_SMB_CRB_AGT_ADR)
228a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_NIU	    ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
229a9083016SGiridhar Malavali 	QLA82XX_HW_NIU_CRB_AGT_ADR)
230a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_I2C0     ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
231a9083016SGiridhar Malavali 	QLA82XX_HW_I2C0_CRB_AGT_ADR)
232a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_I2C1     ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
233a9083016SGiridhar Malavali 	QLA82XX_HW_I2C1_CRB_AGT_ADR)
234a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SRE	    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
235a9083016SGiridhar Malavali 	QLA82XX_HW_SRE_CRB_AGT_ADR)
236a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_EG	    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
237a9083016SGiridhar Malavali 	QLA82XX_HW_EG_CRB_AGT_ADR)
238a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX0    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
239a9083016SGiridhar Malavali 	QLA82XX_HW_RPMX0_CRB_AGT_ADR)
240a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_QMN	    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
241a9083016SGiridhar Malavali 	QLA82XX_HW_QM_CRB_AGT_ADR)
242a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN0     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
243a9083016SGiridhar Malavali 	QLA82XX_HW_SQG0_CRB_AGT_ADR)
244a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN1     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
245a9083016SGiridhar Malavali 	QLA82XX_HW_SQG1_CRB_AGT_ADR)
246a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN2     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
247a9083016SGiridhar Malavali 	QLA82XX_HW_SQG2_CRB_AGT_ADR)
248a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN3     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
249a9083016SGiridhar Malavali 	QLA82XX_HW_SQG3_CRB_AGT_ADR)
250a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX1    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
251a9083016SGiridhar Malavali 	QLA82XX_HW_RPMX1_CRB_AGT_ADR)
252a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX5    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
253a9083016SGiridhar Malavali 	QLA82XX_HW_RPMX5_CRB_AGT_ADR)
254a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX6    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
255a9083016SGiridhar Malavali 	QLA82XX_HW_RPMX6_CRB_AGT_ADR)
256a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX8    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
257a9083016SGiridhar Malavali 	QLA82XX_HW_RPMX8_CRB_AGT_ADR)
258a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS0     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
259a9083016SGiridhar Malavali 	QLA82XX_HW_CAS0_CRB_AGT_ADR)
260a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS1     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
261a9083016SGiridhar Malavali 	QLA82XX_HW_CAS1_CRB_AGT_ADR)
262a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS2     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
263a9083016SGiridhar Malavali 	QLA82XX_HW_CAS2_CRB_AGT_ADR)
264a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS3     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
265a9083016SGiridhar Malavali 	QLA82XX_HW_CAS3_CRB_AGT_ADR)
266a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGNI     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
267a9083016SGiridhar Malavali 	QLA82XX_HW_PEGNI_CRB_AGT_ADR)
268a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGND     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
269a9083016SGiridhar Malavali 	QLA82XX_HW_PEGND_CRB_AGT_ADR)
270a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN0     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
271a9083016SGiridhar Malavali 	QLA82XX_HW_PEGN0_CRB_AGT_ADR)
272a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN1     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
273a9083016SGiridhar Malavali 	QLA82XX_HW_PEGN1_CRB_AGT_ADR)
274a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN2     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
275a9083016SGiridhar Malavali 	QLA82XX_HW_PEGN2_CRB_AGT_ADR)
276a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN3     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
277a9083016SGiridhar Malavali 	QLA82XX_HW_PEGN3_CRB_AGT_ADR)
278a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN4	   ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
279a9083016SGiridhar Malavali 	QLA82XX_HW_PEGN4_CRB_AGT_ADR)
280a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGNC     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
281a9083016SGiridhar Malavali 	QLA82XX_HW_PEGNC_CRB_AGT_ADR)
282a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR0     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
283a9083016SGiridhar Malavali 	QLA82XX_HW_PEGR0_CRB_AGT_ADR)
284a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR1     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
285a9083016SGiridhar Malavali 	QLA82XX_HW_PEGR1_CRB_AGT_ADR)
286a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR2     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
287a9083016SGiridhar Malavali 	QLA82XX_HW_PEGR2_CRB_AGT_ADR)
288a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR3     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
289a9083016SGiridhar Malavali 	QLA82XX_HW_PEGR3_CRB_AGT_ADR)
290a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSI     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
291a9083016SGiridhar Malavali 	QLA82XX_HW_PEGSI_CRB_AGT_ADR)
292a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSD     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
293a9083016SGiridhar Malavali 	QLA82XX_HW_PEGSD_CRB_AGT_ADR)
294a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS0     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
295a9083016SGiridhar Malavali 	QLA82XX_HW_PEGS0_CRB_AGT_ADR)
296a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS1     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
297a9083016SGiridhar Malavali 	QLA82XX_HW_PEGS1_CRB_AGT_ADR)
298a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS2     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
299a9083016SGiridhar Malavali 	QLA82XX_HW_PEGS2_CRB_AGT_ADR)
300a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS3     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
301a9083016SGiridhar Malavali 	QLA82XX_HW_PEGS3_CRB_AGT_ADR)
302a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSC     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
303a9083016SGiridhar Malavali 	QLA82XX_HW_PEGSC_CRB_AGT_ADR)
304a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_CAM	    ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
305a9083016SGiridhar Malavali 	QLA82XX_HW_NCM_CRB_AGT_ADR)
306a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_TIMR     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
307a9083016SGiridhar Malavali 	QLA82XX_HW_TMR_CRB_AGT_ADR)
308a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_XDMA     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
309a9083016SGiridhar Malavali 	QLA82XX_HW_XDMA_CRB_AGT_ADR)
310a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_SN	    ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
311a9083016SGiridhar Malavali 	QLA82XX_HW_SN_CRB_AGT_ADR)
312a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_I2Q	    ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
313a9083016SGiridhar Malavali 	QLA82XX_HW_I2Q_CRB_AGT_ADR)
314a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_ROMUSB   ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
315a9083016SGiridhar Malavali 	QLA82XX_HW_ROMUSB_CRB_AGT_ADR)
316a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_OCM0     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
317a9083016SGiridhar Malavali 	QLA82XX_HW_OCM0_CRB_AGT_ADR)
318a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_OCM1     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
319a9083016SGiridhar Malavali 	QLA82XX_HW_OCM1_CRB_AGT_ADR)
320a9083016SGiridhar Malavali #define QLA82XX_HW_CRB_HUB_AGT_ADR_LPC	    ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
321a9083016SGiridhar Malavali 	QLA82XX_HW_LPC_CRB_AGT_ADR)
322a9083016SGiridhar Malavali 
323a9083016SGiridhar Malavali #define ROMUSB_GLB				(QLA82XX_CRB_ROMUSB + 0x00000)
324a9083016SGiridhar Malavali #define QLA82XX_ROMUSB_GLB_PEGTUNE_DONE		(ROMUSB_GLB + 0x005c)
325a9083016SGiridhar Malavali #define QLA82XX_ROMUSB_GLB_STATUS		(ROMUSB_GLB + 0x0004)
326a9083016SGiridhar Malavali #define QLA82XX_ROMUSB_GLB_SW_RESET		(ROMUSB_GLB + 0x0008)
327a9083016SGiridhar Malavali #define QLA82XX_ROMUSB_ROM_ADDRESS		(ROMUSB_ROM + 0x0008)
328a9083016SGiridhar Malavali #define QLA82XX_ROMUSB_ROM_WDATA		(ROMUSB_ROM + 0x000c)
329a9083016SGiridhar Malavali #define QLA82XX_ROMUSB_ROM_ABYTE_CNT		(ROMUSB_ROM + 0x0010)
330a9083016SGiridhar Malavali #define QLA82XX_ROMUSB_ROM_DUMMY_BYTE_CNT	(ROMUSB_ROM + 0x0014)
331a9083016SGiridhar Malavali #define QLA82XX_ROMUSB_ROM_RDATA		(ROMUSB_ROM + 0x0018)
332a9083016SGiridhar Malavali 
333a9083016SGiridhar Malavali #define ROMUSB_ROM				(QLA82XX_CRB_ROMUSB + 0x10000)
334a9083016SGiridhar Malavali #define QLA82XX_ROMUSB_ROM_INSTR_OPCODE		(ROMUSB_ROM + 0x0004)
335a9083016SGiridhar Malavali #define QLA82XX_ROMUSB_GLB_CAS_RST		(ROMUSB_GLB + 0x0038)
336a9083016SGiridhar Malavali 
337a9083016SGiridhar Malavali #define QLA82XX_PCI_CRB_WINDOWSIZE 0x00100000	 /* all are 1MB windows */
338a9083016SGiridhar Malavali #define QLA82XX_PCI_CRB_WINDOW(A) \
339a9083016SGiridhar Malavali 	(QLA82XX_PCI_CRBSPACE + (A)*QLA82XX_PCI_CRB_WINDOWSIZE)
340a9083016SGiridhar Malavali #define QLA82XX_CRB_C2C_0 \
341a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C0)
342a9083016SGiridhar Malavali #define QLA82XX_CRB_C2C_1 \
343a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C1)
344a9083016SGiridhar Malavali #define QLA82XX_CRB_C2C_2 \
345a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C2)
346a9083016SGiridhar Malavali #define QLA82XX_CRB_CAM \
347a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAM)
348a9083016SGiridhar Malavali #define QLA82XX_CRB_CASPER \
349a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS)
350a9083016SGiridhar Malavali #define QLA82XX_CRB_CASPER_0 \
351a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS0)
352a9083016SGiridhar Malavali #define QLA82XX_CRB_CASPER_1 \
353a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS1)
354a9083016SGiridhar Malavali #define QLA82XX_CRB_CASPER_2 \
355a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS2)
356a9083016SGiridhar Malavali #define QLA82XX_CRB_DDR_MD \
357a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_MS)
358a9083016SGiridhar Malavali #define QLA82XX_CRB_DDR_NET \
359a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_MN)
360a9083016SGiridhar Malavali #define QLA82XX_CRB_EPG \
361a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_EG)
362a9083016SGiridhar Malavali #define QLA82XX_CRB_I2Q \
363a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2Q)
364a9083016SGiridhar Malavali #define QLA82XX_CRB_NIU \
365a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_NIU)
366a9083016SGiridhar Malavali 
367a9083016SGiridhar Malavali #define QLA82XX_CRB_PCIX_HOST \
368a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PH)
369a9083016SGiridhar Malavali #define QLA82XX_CRB_PCIX_HOST2 \
370a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PH2)
371a9083016SGiridhar Malavali #define QLA82XX_CRB_PCIX_MD \
372a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PS)
373a9083016SGiridhar Malavali #define QLA82XX_CRB_PCIE \
374a9083016SGiridhar Malavali 	QLA82XX_CRB_PCIX_MD
375a9083016SGiridhar Malavali 
376a9083016SGiridhar Malavali /* window 1 pcie slot */
377a9083016SGiridhar Malavali #define QLA82XX_CRB_PCIE2	 \
378a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PS2)
379a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_MD_0 \
380a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS0)
381a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_MD_1 \
382a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS1)
383a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_MD_2 \
384a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS2)
385a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_MD_3 \
386a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS3)
387a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_MD_3 \
388a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS3)
389a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_MD_D \
390a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGSD)
391a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_MD_I \
392a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGSI)
393a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_NET_0 \
394a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN0)
395a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_NET_1 \
396a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN1)
397a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_NET_2 \
398a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN2)
399a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_NET_3 \
400a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN3)
401a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_NET_4 \
402a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN4)
403a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_NET_D \
404a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGND)
405a9083016SGiridhar Malavali #define QLA82XX_CRB_PEG_NET_I \
406a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGNI)
407a9083016SGiridhar Malavali #define QLA82XX_CRB_PQM_MD \
408a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_QMS)
409a9083016SGiridhar Malavali #define QLA82XX_CRB_PQM_NET \
410a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_QMN)
411a9083016SGiridhar Malavali #define QLA82XX_CRB_QDR_MD \
412a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SS)
413a9083016SGiridhar Malavali #define QLA82XX_CRB_QDR_NET \
414a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SN)
415a9083016SGiridhar Malavali #define QLA82XX_CRB_ROMUSB \
416a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_ROMUSB)
417a9083016SGiridhar Malavali #define QLA82XX_CRB_RPMX_0 \
418a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX0)
419a9083016SGiridhar Malavali #define QLA82XX_CRB_RPMX_1 \
420a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX1)
421a9083016SGiridhar Malavali #define QLA82XX_CRB_RPMX_2 \
422a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX2)
423a9083016SGiridhar Malavali #define QLA82XX_CRB_RPMX_3 \
424a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX3)
425a9083016SGiridhar Malavali #define QLA82XX_CRB_RPMX_4 \
426a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX4)
427a9083016SGiridhar Malavali #define QLA82XX_CRB_RPMX_5 \
428a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX5)
429a9083016SGiridhar Malavali #define QLA82XX_CRB_RPMX_6 \
430a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX6)
431a9083016SGiridhar Malavali #define QLA82XX_CRB_RPMX_7 \
432a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX7)
433a9083016SGiridhar Malavali #define QLA82XX_CRB_SQM_MD_0 \
434a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS0)
435a9083016SGiridhar Malavali #define QLA82XX_CRB_SQM_MD_1 \
436a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS1)
437a9083016SGiridhar Malavali #define QLA82XX_CRB_SQM_MD_2 \
438a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS2)
439a9083016SGiridhar Malavali #define QLA82XX_CRB_SQM_MD_3 \
440a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS3)
441a9083016SGiridhar Malavali #define QLA82XX_CRB_SQM_NET_0 \
442a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN0)
443a9083016SGiridhar Malavali #define QLA82XX_CRB_SQM_NET_1 \
444a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN1)
445a9083016SGiridhar Malavali #define QLA82XX_CRB_SQM_NET_2 \
446a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN2)
447a9083016SGiridhar Malavali #define QLA82XX_CRB_SQM_NET_3 \
448a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN3)
449a9083016SGiridhar Malavali #define QLA82XX_CRB_SRE \
450a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SRE)
451a9083016SGiridhar Malavali #define QLA82XX_CRB_TIMER \
452a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_TIMR)
453a9083016SGiridhar Malavali #define QLA82XX_CRB_XDMA \
454a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_XDMA)
455a9083016SGiridhar Malavali #define QLA82XX_CRB_I2C0 \
456a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2C0)
457a9083016SGiridhar Malavali #define QLA82XX_CRB_I2C1 \
458a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2C1)
459a9083016SGiridhar Malavali #define QLA82XX_CRB_OCM0 \
460a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_OCM0)
461a9083016SGiridhar Malavali #define QLA82XX_CRB_SMB \
462a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SMB)
463a9083016SGiridhar Malavali #define QLA82XX_CRB_MAX \
464a9083016SGiridhar Malavali 	QLA82XX_PCI_CRB_WINDOW(64)
465a9083016SGiridhar Malavali 
466a9083016SGiridhar Malavali /*
467a9083016SGiridhar Malavali  * ====================== BASE ADDRESSES ON-CHIP ======================
468a9083016SGiridhar Malavali  * Base addresses of major components on-chip.
469a9083016SGiridhar Malavali  * ====================== BASE ADDRESSES ON-CHIP ======================
470a9083016SGiridhar Malavali  */
471a9083016SGiridhar Malavali #define QLA82XX_ADDR_DDR_NET		(0x0000000000000000ULL)
472a9083016SGiridhar Malavali #define QLA82XX_ADDR_DDR_NET_MAX	(0x000000000fffffffULL)
473a9083016SGiridhar Malavali 
474a9083016SGiridhar Malavali /* Imbus address bit used to indicate a host address. This bit is
475a9083016SGiridhar Malavali  * eliminated by the pcie bar and bar select before presentation
476a9083016SGiridhar Malavali  * over pcie. */
477a9083016SGiridhar Malavali /* host memory via IMBUS */
478a9083016SGiridhar Malavali #define QLA82XX_P2_ADDR_PCIE		(0x0000000800000000ULL)
479a9083016SGiridhar Malavali #define QLA82XX_P3_ADDR_PCIE		(0x0000008000000000ULL)
480a9083016SGiridhar Malavali #define QLA82XX_ADDR_PCIE_MAX		(0x0000000FFFFFFFFFULL)
481a9083016SGiridhar Malavali #define QLA82XX_ADDR_OCM0		(0x0000000200000000ULL)
482a9083016SGiridhar Malavali #define QLA82XX_ADDR_OCM0_MAX		(0x00000002000fffffULL)
483a9083016SGiridhar Malavali #define QLA82XX_ADDR_OCM1		(0x0000000200400000ULL)
484a9083016SGiridhar Malavali #define QLA82XX_ADDR_OCM1_MAX		(0x00000002004fffffULL)
485a9083016SGiridhar Malavali #define QLA82XX_ADDR_QDR_NET		(0x0000000300000000ULL)
486a9083016SGiridhar Malavali #define QLA82XX_P3_ADDR_QDR_NET_MAX	(0x0000000303ffffffULL)
487a9083016SGiridhar Malavali 
488c1c7178cSBart Van Assche #define QLA82XX_PCI_CRBSPACE		0x06000000UL
489c1c7178cSBart Van Assche #define QLA82XX_PCI_DIRECT_CRB		0x04400000UL
490c1c7178cSBart Van Assche #define QLA82XX_PCI_CAMQM		0x04800000UL
491c1c7178cSBart Van Assche #define QLA82XX_PCI_CAMQM_MAX		0x04ffffffUL
492c1c7178cSBart Van Assche #define QLA82XX_PCI_DDR_NET		0x00000000UL
493c1c7178cSBart Van Assche #define QLA82XX_PCI_QDR_NET		0x04000000UL
494c1c7178cSBart Van Assche #define QLA82XX_PCI_QDR_NET_MAX		0x043fffffUL
495a9083016SGiridhar Malavali 
496a9083016SGiridhar Malavali /*
497a9083016SGiridhar Malavali  *   Register offsets for MN
498a9083016SGiridhar Malavali  */
499a9083016SGiridhar Malavali #define MIU_CONTROL			(0x000)
500a9083016SGiridhar Malavali #define MIU_TAG				(0x004)
501a9083016SGiridhar Malavali #define MIU_TEST_AGT_CTRL		(0x090)
502a9083016SGiridhar Malavali #define MIU_TEST_AGT_ADDR_LO		(0x094)
503a9083016SGiridhar Malavali #define MIU_TEST_AGT_ADDR_HI		(0x098)
504a9083016SGiridhar Malavali #define MIU_TEST_AGT_WRDATA_LO		(0x0a0)
505a9083016SGiridhar Malavali #define MIU_TEST_AGT_WRDATA_HI		(0x0a4)
506a9083016SGiridhar Malavali #define MIU_TEST_AGT_WRDATA(i)		(0x0a0+(4*(i)))
507a9083016SGiridhar Malavali #define MIU_TEST_AGT_RDDATA_LO		(0x0a8)
508a9083016SGiridhar Malavali #define MIU_TEST_AGT_RDDATA_HI		(0x0ac)
509a9083016SGiridhar Malavali #define MIU_TEST_AGT_RDDATA(i)		(0x0a8+(4*(i)))
510a9083016SGiridhar Malavali #define MIU_TEST_AGT_ADDR_MASK		0xfffffff8
511a9083016SGiridhar Malavali #define MIU_TEST_AGT_UPPER_ADDR(off)	(0)
512a9083016SGiridhar Malavali 
513a9083016SGiridhar Malavali /* MIU_TEST_AGT_CTRL flags. work for SIU as well */
514a9083016SGiridhar Malavali #define MIU_TA_CTL_START	1
515a9083016SGiridhar Malavali #define MIU_TA_CTL_ENABLE	2
516a9083016SGiridhar Malavali #define MIU_TA_CTL_WRITE	4
517a9083016SGiridhar Malavali #define MIU_TA_CTL_BUSY		8
518a9083016SGiridhar Malavali 
519a9083016SGiridhar Malavali /*CAM RAM */
520a9083016SGiridhar Malavali # define QLA82XX_CAM_RAM_BASE		(QLA82XX_CRB_CAM + 0x02000)
521a9083016SGiridhar Malavali # define QLA82XX_CAM_RAM(reg)		(QLA82XX_CAM_RAM_BASE + (reg))
522a9083016SGiridhar Malavali 
523a9083016SGiridhar Malavali #define QLA82XX_PORT_MODE_ADDR		(QLA82XX_CAM_RAM(0x24))
524a9083016SGiridhar Malavali #define QLA82XX_PEG_HALT_STATUS1	(QLA82XX_CAM_RAM(0xa8))
525a9083016SGiridhar Malavali #define QLA82XX_PEG_HALT_STATUS2	(QLA82XX_CAM_RAM(0xac))
526a9083016SGiridhar Malavali #define QLA82XX_PEG_ALIVE_COUNTER	(QLA82XX_CAM_RAM(0xb0))
527a9083016SGiridhar Malavali 
528a9083016SGiridhar Malavali #define QLA82XX_CAMRAM_DB1		(QLA82XX_CAM_RAM(0x1b8))
529a9083016SGiridhar Malavali #define QLA82XX_CAMRAM_DB2		(QLA82XX_CAM_RAM(0x1bc))
530a9083016SGiridhar Malavali 
531a9083016SGiridhar Malavali #define HALT_STATUS_UNRECOVERABLE	0x80000000
532a9083016SGiridhar Malavali #define HALT_STATUS_RECOVERABLE		0x40000000
533a9083016SGiridhar Malavali 
534a9083016SGiridhar Malavali /* Driver Coexistence Defines */
535a9083016SGiridhar Malavali #define QLA82XX_CRB_DRV_ACTIVE	     (QLA82XX_CAM_RAM(0x138))
536a9083016SGiridhar Malavali #define QLA82XX_CRB_DEV_STATE	     (QLA82XX_CAM_RAM(0x140))
537a9083016SGiridhar Malavali #define QLA82XX_CRB_DRV_STATE	     (QLA82XX_CAM_RAM(0x144))
538a9083016SGiridhar Malavali #define QLA82XX_CRB_DRV_SCRATCH      (QLA82XX_CAM_RAM(0x148))
539a9083016SGiridhar Malavali #define QLA82XX_CRB_DEV_PART_INFO    (QLA82XX_CAM_RAM(0x14c))
540b963752fSGiridhar Malavali #define QLA82XX_CRB_DRV_IDC_VERSION  (QLA82XX_CAM_RAM(0x174))
541a9083016SGiridhar Malavali 
542a9083016SGiridhar Malavali /* Every driver should use these Device State */
5431f652aa0SGleb Chesnokov enum {
5441f652aa0SGleb Chesnokov 	QLA8XXX_DEV_UNKNOWN,
5451f652aa0SGleb Chesnokov 	QLA8XXX_DEV_COLD,
5461f652aa0SGleb Chesnokov 	QLA8XXX_DEV_INITIALIZING,
5471f652aa0SGleb Chesnokov 	QLA8XXX_DEV_READY,
5481f652aa0SGleb Chesnokov 	QLA8XXX_DEV_NEED_RESET,
5491f652aa0SGleb Chesnokov 	QLA8XXX_DEV_NEED_QUIESCENT,
5501f652aa0SGleb Chesnokov 	QLA8XXX_DEV_FAILED,
5511f652aa0SGleb Chesnokov 	QLA8XXX_DEV_QUIESCENT,
5521f652aa0SGleb Chesnokov 	MAX_STATES, /* Increment if new state added */
5531f652aa0SGleb Chesnokov };
5541f652aa0SGleb Chesnokov 
5557d613ac6SSantosh Vernekar #define QLA8XXX_BAD_VALUE		0xbad0bad0
556a9083016SGiridhar Malavali 
557a9083016SGiridhar Malavali #define QLA82XX_IDC_VERSION			1
558a9083016SGiridhar Malavali #define QLA82XX_ROM_DEV_INIT_TIMEOUT		30
559a9083016SGiridhar Malavali #define QLA82XX_ROM_DRV_RESET_ACK_TIMEOUT	10
560a9083016SGiridhar Malavali 
561a9083016SGiridhar Malavali #define QLA82XX_ROM_LOCK_ID		(QLA82XX_CAM_RAM(0x100))
562a9083016SGiridhar Malavali #define QLA82XX_CRB_WIN_LOCK_ID		(QLA82XX_CAM_RAM(0x124))
563a9083016SGiridhar Malavali #define QLA82XX_FW_VERSION_MAJOR	(QLA82XX_CAM_RAM(0x150))
564a9083016SGiridhar Malavali #define QLA82XX_FW_VERSION_MINOR	(QLA82XX_CAM_RAM(0x154))
565a9083016SGiridhar Malavali #define QLA82XX_FW_VERSION_SUB		(QLA82XX_CAM_RAM(0x158))
566a9083016SGiridhar Malavali #define QLA82XX_PCIE_REG(reg)		(QLA82XX_CRB_PCIE + (reg))
567a9083016SGiridhar Malavali 
568a9083016SGiridhar Malavali #define PCIE_SETUP_FUNCTION		(0x12040)
569a9083016SGiridhar Malavali #define PCIE_SETUP_FUNCTION2		(0x12048)
570a9083016SGiridhar Malavali 
571a9083016SGiridhar Malavali #define QLA82XX_PCIX_PS_REG(reg)	(QLA82XX_CRB_PCIX_MD + (reg))
572a9083016SGiridhar Malavali #define QLA82XX_PCIX_PS2_REG(reg)	(QLA82XX_CRB_PCIE2 + (reg))
573a9083016SGiridhar Malavali 
574a9083016SGiridhar Malavali #define PCIE_SEM2_LOCK	     (0x1c010)	/* Flash lock	*/
575a9083016SGiridhar Malavali #define PCIE_SEM2_UNLOCK     (0x1c014)	/* Flash unlock */
576a9083016SGiridhar Malavali #define PCIE_SEM5_LOCK	     (0x1c028)	/* Coexistence lock   */
577a9083016SGiridhar Malavali #define PCIE_SEM5_UNLOCK     (0x1c02c)	/* Coexistence unlock */
578a9083016SGiridhar Malavali #define PCIE_SEM7_LOCK	     (0x1c038)	/* crb win lock */
579a9083016SGiridhar Malavali #define PCIE_SEM7_UNLOCK     (0x1c03c)	/* crbwin unlock*/
580a9083016SGiridhar Malavali 
581a9083016SGiridhar Malavali /* Different drive state */
582a9083016SGiridhar Malavali #define QLA82XX_DRVST_NOT_RDY		0
583a9083016SGiridhar Malavali #define	QLA82XX_DRVST_RST_RDY		1
584a9083016SGiridhar Malavali #define QLA82XX_DRVST_QSNT_RDY		2
585a9083016SGiridhar Malavali 
58677e334d2SGiridhar Malavali /* Different drive active state */
58777e334d2SGiridhar Malavali #define QLA82XX_DRV_NOT_ACTIVE		0
58877e334d2SGiridhar Malavali #define QLA82XX_DRV_ACTIVE		1
58977e334d2SGiridhar Malavali 
590a9083016SGiridhar Malavali /*
591a9083016SGiridhar Malavali  * The PCI VendorID and DeviceID for our board.
592a9083016SGiridhar Malavali  */
593a9083016SGiridhar Malavali #define PCI_DEVICE_ID_QLOGIC_ISP8021		0x8021
5947ec0effdSAtul Deshmukh #define PCI_DEVICE_ID_QLOGIC_ISP8044		0x8044
595a9083016SGiridhar Malavali 
596a9083016SGiridhar Malavali #define QLA82XX_MSIX_TBL_SPACE			8192
597a9083016SGiridhar Malavali #define QLA82XX_PCI_REG_MSIX_TBL		0x44
598a9083016SGiridhar Malavali #define QLA82XX_PCI_MSIX_CONTROL		0x40
599a9083016SGiridhar Malavali 
600a9083016SGiridhar Malavali struct crb_128M_2M_sub_block_map {
601a9083016SGiridhar Malavali 	unsigned valid;
602a9083016SGiridhar Malavali 	unsigned start_128M;
603a9083016SGiridhar Malavali 	unsigned end_128M;
604a9083016SGiridhar Malavali 	unsigned start_2M;
605a9083016SGiridhar Malavali };
606a9083016SGiridhar Malavali 
607a9083016SGiridhar Malavali struct crb_128M_2M_block_map {
608a9083016SGiridhar Malavali 	struct crb_128M_2M_sub_block_map sub_block[16];
609a9083016SGiridhar Malavali };
610a9083016SGiridhar Malavali 
611a9083016SGiridhar Malavali struct crb_addr_pair {
612a9083016SGiridhar Malavali 	long addr;
613a9083016SGiridhar Malavali 	long data;
614a9083016SGiridhar Malavali };
615a9083016SGiridhar Malavali 
616a9083016SGiridhar Malavali #define ADDR_ERROR ((unsigned long) 0xffffffff)
617a9083016SGiridhar Malavali #define MAX_CTL_CHECK	1000
618a9083016SGiridhar Malavali 
619a9083016SGiridhar Malavali /***************************************************************************
620a9083016SGiridhar Malavali  *		PCI related defines.
621a9083016SGiridhar Malavali  **************************************************************************/
622a9083016SGiridhar Malavali 
623a9083016SGiridhar Malavali /*
624a9083016SGiridhar Malavali  * Interrupt related defines.
625a9083016SGiridhar Malavali  */
626a9083016SGiridhar Malavali #define PCIX_TARGET_STATUS	(0x10118)
627a9083016SGiridhar Malavali #define PCIX_TARGET_STATUS_F1	(0x10160)
628a9083016SGiridhar Malavali #define PCIX_TARGET_STATUS_F2	(0x10164)
629a9083016SGiridhar Malavali #define PCIX_TARGET_STATUS_F3	(0x10168)
630a9083016SGiridhar Malavali #define PCIX_TARGET_STATUS_F4	(0x10360)
631a9083016SGiridhar Malavali #define PCIX_TARGET_STATUS_F5	(0x10364)
632a9083016SGiridhar Malavali #define PCIX_TARGET_STATUS_F6	(0x10368)
633a9083016SGiridhar Malavali #define PCIX_TARGET_STATUS_F7	(0x1036c)
634a9083016SGiridhar Malavali 
635a9083016SGiridhar Malavali #define PCIX_TARGET_MASK	(0x10128)
636a9083016SGiridhar Malavali #define PCIX_TARGET_MASK_F1	(0x10170)
637a9083016SGiridhar Malavali #define PCIX_TARGET_MASK_F2	(0x10174)
638a9083016SGiridhar Malavali #define PCIX_TARGET_MASK_F3	(0x10178)
639a9083016SGiridhar Malavali #define PCIX_TARGET_MASK_F4	(0x10370)
640a9083016SGiridhar Malavali #define PCIX_TARGET_MASK_F5	(0x10374)
641a9083016SGiridhar Malavali #define PCIX_TARGET_MASK_F6	(0x10378)
642a9083016SGiridhar Malavali #define PCIX_TARGET_MASK_F7	(0x1037c)
643a9083016SGiridhar Malavali 
644a9083016SGiridhar Malavali /*
645a9083016SGiridhar Malavali  * Message Signaled Interrupts
646a9083016SGiridhar Malavali  */
647a9083016SGiridhar Malavali #define PCIX_MSI_F0		(0x13000)
648a9083016SGiridhar Malavali #define PCIX_MSI_F1		(0x13004)
649a9083016SGiridhar Malavali #define PCIX_MSI_F2		(0x13008)
650a9083016SGiridhar Malavali #define PCIX_MSI_F3		(0x1300c)
651a9083016SGiridhar Malavali #define PCIX_MSI_F4		(0x13010)
652a9083016SGiridhar Malavali #define PCIX_MSI_F5		(0x13014)
653a9083016SGiridhar Malavali #define PCIX_MSI_F6		(0x13018)
654a9083016SGiridhar Malavali #define PCIX_MSI_F7		(0x1301c)
655a9083016SGiridhar Malavali #define PCIX_MSI_F(FUNC)	(0x13000 + ((FUNC) * 4))
656a9083016SGiridhar Malavali #define PCIX_INT_VECTOR		(0x10100)
657a9083016SGiridhar Malavali #define PCIX_INT_MASK		(0x10104)
658a9083016SGiridhar Malavali 
659a9083016SGiridhar Malavali /*
660a9083016SGiridhar Malavali  * Interrupt state machine and other bits.
661a9083016SGiridhar Malavali  */
662a9083016SGiridhar Malavali #define PCIE_MISCCFG_RC		(0x1206c)
663a9083016SGiridhar Malavali 
664a9083016SGiridhar Malavali #define ISR_INT_TARGET_STATUS \
665a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS))
666a9083016SGiridhar Malavali #define ISR_INT_TARGET_STATUS_F1 \
667a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F1))
668a9083016SGiridhar Malavali #define ISR_INT_TARGET_STATUS_F2 \
669a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F2))
670a9083016SGiridhar Malavali #define ISR_INT_TARGET_STATUS_F3 \
671a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F3))
672a9083016SGiridhar Malavali #define ISR_INT_TARGET_STATUS_F4 \
673a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F4))
674a9083016SGiridhar Malavali #define ISR_INT_TARGET_STATUS_F5 \
675a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F5))
676a9083016SGiridhar Malavali #define ISR_INT_TARGET_STATUS_F6 \
677a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F6))
678a9083016SGiridhar Malavali #define ISR_INT_TARGET_STATUS_F7 \
679a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F7))
680a9083016SGiridhar Malavali 
681a9083016SGiridhar Malavali #define ISR_INT_TARGET_MASK \
682a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK))
683a9083016SGiridhar Malavali #define ISR_INT_TARGET_MASK_F1 \
684a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F1))
685a9083016SGiridhar Malavali #define ISR_INT_TARGET_MASK_F2 \
686a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F2))
687a9083016SGiridhar Malavali #define ISR_INT_TARGET_MASK_F3 \
688a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F3))
689a9083016SGiridhar Malavali #define ISR_INT_TARGET_MASK_F4 \
690a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F4))
691a9083016SGiridhar Malavali #define ISR_INT_TARGET_MASK_F5 \
692a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F5))
693a9083016SGiridhar Malavali #define ISR_INT_TARGET_MASK_F6 \
694a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F6))
695a9083016SGiridhar Malavali #define ISR_INT_TARGET_MASK_F7 \
696a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F7))
697a9083016SGiridhar Malavali 
698a9083016SGiridhar Malavali #define ISR_INT_VECTOR \
699a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_INT_VECTOR))
700a9083016SGiridhar Malavali #define ISR_INT_MASK \
701a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_INT_MASK))
702a9083016SGiridhar Malavali #define ISR_INT_STATE_REG \
703a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIE_MISCCFG_RC))
704a9083016SGiridhar Malavali 
705a9083016SGiridhar Malavali #define	ISR_MSI_INT_TRIGGER(FUNC) \
706a9083016SGiridhar Malavali 	(QLA82XX_PCIX_PS_REG(PCIX_MSI_F(FUNC)))
707a9083016SGiridhar Malavali 
708a9083016SGiridhar Malavali #define	ISR_IS_LEGACY_INTR_IDLE(VAL)		(((VAL) & 0x300) == 0)
709a9083016SGiridhar Malavali #define	ISR_IS_LEGACY_INTR_TRIGGERED(VAL)	(((VAL) & 0x300) == 0x200)
710a9083016SGiridhar Malavali 
711a9083016SGiridhar Malavali /*
712a9083016SGiridhar Malavali  * PCI Interrupt Vector Values.
713a9083016SGiridhar Malavali  */
714a9083016SGiridhar Malavali #define	PCIX_INT_VECTOR_BIT_F0	0x0080
715a9083016SGiridhar Malavali #define	PCIX_INT_VECTOR_BIT_F1	0x0100
716a9083016SGiridhar Malavali #define	PCIX_INT_VECTOR_BIT_F2	0x0200
717a9083016SGiridhar Malavali #define	PCIX_INT_VECTOR_BIT_F3	0x0400
718a9083016SGiridhar Malavali #define	PCIX_INT_VECTOR_BIT_F4	0x0800
719a9083016SGiridhar Malavali #define	PCIX_INT_VECTOR_BIT_F5	0x1000
720a9083016SGiridhar Malavali #define	PCIX_INT_VECTOR_BIT_F6	0x2000
721a9083016SGiridhar Malavali #define	PCIX_INT_VECTOR_BIT_F7	0x4000
722a9083016SGiridhar Malavali 
723a9083016SGiridhar Malavali struct qla82xx_legacy_intr_set {
724a9083016SGiridhar Malavali 	uint32_t	int_vec_bit;
725a9083016SGiridhar Malavali 	uint32_t	tgt_status_reg;
726a9083016SGiridhar Malavali 	uint32_t	tgt_mask_reg;
727a9083016SGiridhar Malavali 	uint32_t	pci_int_reg;
728a9083016SGiridhar Malavali };
729a9083016SGiridhar Malavali 
730a9083016SGiridhar Malavali #define QLA82XX_LEGACY_INTR_CONFIG					\
731a9083016SGiridhar Malavali {									\
732a9083016SGiridhar Malavali 	{								\
733a9083016SGiridhar Malavali 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F0,		\
734a9083016SGiridhar Malavali 		.tgt_status_reg =	ISR_INT_TARGET_STATUS,		\
735a9083016SGiridhar Malavali 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK,		\
736a9083016SGiridhar Malavali 		.pci_int_reg	=	ISR_MSI_INT_TRIGGER(0) },	\
737a9083016SGiridhar Malavali 									\
738a9083016SGiridhar Malavali 	{								\
739a9083016SGiridhar Malavali 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F1,		\
740a9083016SGiridhar Malavali 		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F1,	\
741a9083016SGiridhar Malavali 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F1,		\
742a9083016SGiridhar Malavali 		.pci_int_reg	=	ISR_MSI_INT_TRIGGER(1) },	\
743a9083016SGiridhar Malavali 									\
744a9083016SGiridhar Malavali 	{								\
745a9083016SGiridhar Malavali 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F2,		\
746a9083016SGiridhar Malavali 		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F2,	\
747a9083016SGiridhar Malavali 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F2,		\
748a9083016SGiridhar Malavali 		.pci_int_reg	=	ISR_MSI_INT_TRIGGER(2) },	\
749a9083016SGiridhar Malavali 									\
750a9083016SGiridhar Malavali 	{								\
751a9083016SGiridhar Malavali 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F3,		\
752a9083016SGiridhar Malavali 		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F3,	\
753a9083016SGiridhar Malavali 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F3,		\
754a9083016SGiridhar Malavali 		.pci_int_reg	=	ISR_MSI_INT_TRIGGER(3) },	\
755a9083016SGiridhar Malavali 									\
756a9083016SGiridhar Malavali 	{								\
757a9083016SGiridhar Malavali 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F4,		\
758a9083016SGiridhar Malavali 		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F4,	\
759a9083016SGiridhar Malavali 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F4,		\
760a9083016SGiridhar Malavali 		.pci_int_reg	=	ISR_MSI_INT_TRIGGER(4) },	\
761a9083016SGiridhar Malavali 									\
762a9083016SGiridhar Malavali 	{								\
763a9083016SGiridhar Malavali 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F5,		\
764a9083016SGiridhar Malavali 		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F5,	\
765a9083016SGiridhar Malavali 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F5,		\
766a9083016SGiridhar Malavali 		.pci_int_reg	=	ISR_MSI_INT_TRIGGER(5) },	\
767a9083016SGiridhar Malavali 									\
768a9083016SGiridhar Malavali 	{								\
769a9083016SGiridhar Malavali 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F6,		\
770a9083016SGiridhar Malavali 		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F6,	\
771a9083016SGiridhar Malavali 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F6,		\
772a9083016SGiridhar Malavali 		.pci_int_reg	=	ISR_MSI_INT_TRIGGER(6) },	\
773a9083016SGiridhar Malavali 									\
774a9083016SGiridhar Malavali 	{								\
775a9083016SGiridhar Malavali 		.int_vec_bit	=	PCIX_INT_VECTOR_BIT_F7,		\
776a9083016SGiridhar Malavali 		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F7,	\
777a9083016SGiridhar Malavali 		.tgt_mask_reg	=	ISR_INT_TARGET_MASK_F7,		\
778a9083016SGiridhar Malavali 		.pci_int_reg	=	ISR_MSI_INT_TRIGGER(7) },	\
779a9083016SGiridhar Malavali }
780a9083016SGiridhar Malavali 
7819c2b2975SHarish Zunjarrao #define BRDCFG_START		0x4000
782a9083016SGiridhar Malavali #define	BOOTLD_START		0x10000
783a9083016SGiridhar Malavali #define	IMAGE_START		0x100000
784a9083016SGiridhar Malavali #define FLASH_ADDR_START	0x43000
785a9083016SGiridhar Malavali 
786a9083016SGiridhar Malavali /* Magic number to let user know flash is programmed */
787a9083016SGiridhar Malavali #define QLA82XX_BDINFO_MAGIC	0x12345678
7889c2b2975SHarish Zunjarrao #define QLA82XX_FW_MAGIC_OFFSET	(BRDCFG_START + 0x128)
789a9083016SGiridhar Malavali #define FW_SIZE_OFFSET		(0x3e840c)
7909c2b2975SHarish Zunjarrao #define QLA82XX_FW_MIN_SIZE	0x3fffff
7919c2b2975SHarish Zunjarrao 
7929c2b2975SHarish Zunjarrao /* UNIFIED ROMIMAGE START */
7939c2b2975SHarish Zunjarrao #define QLA82XX_URI_FW_MIN_SIZE			0xc8000
7949c2b2975SHarish Zunjarrao #define QLA82XX_URI_DIR_SECT_PRODUCT_TBL	0x0
7959c2b2975SHarish Zunjarrao #define QLA82XX_URI_DIR_SECT_BOOTLD		0x6
7969c2b2975SHarish Zunjarrao #define QLA82XX_URI_DIR_SECT_FW			0x7
7979c2b2975SHarish Zunjarrao 
7989c2b2975SHarish Zunjarrao /* Offsets */
7999c2b2975SHarish Zunjarrao #define QLA82XX_URI_CHIP_REV_OFF	10
8009c2b2975SHarish Zunjarrao #define QLA82XX_URI_FLAGS_OFF		11
8019c2b2975SHarish Zunjarrao #define QLA82XX_URI_BIOS_VERSION_OFF	12
8029c2b2975SHarish Zunjarrao #define QLA82XX_URI_BOOTLD_IDX_OFF	27
8039c2b2975SHarish Zunjarrao #define QLA82XX_URI_FIRMWARE_IDX_OFF	29
8049c2b2975SHarish Zunjarrao 
8059c2b2975SHarish Zunjarrao struct qla82xx_uri_table_desc{
80621038b09SBart Van Assche 	__le32	findex;
80721038b09SBart Van Assche 	__le32	num_entries;
80821038b09SBart Van Assche 	__le32	entry_size;
80921038b09SBart Van Assche 	__le32	reserved[5];
8109c2b2975SHarish Zunjarrao };
8119c2b2975SHarish Zunjarrao 
8129c2b2975SHarish Zunjarrao struct qla82xx_uri_data_desc{
81321038b09SBart Van Assche 	__le32	findex;
81421038b09SBart Van Assche 	__le32	size;
81521038b09SBart Van Assche 	__le32	reserved[5];
8169c2b2975SHarish Zunjarrao };
8179c2b2975SHarish Zunjarrao 
8189c2b2975SHarish Zunjarrao /* UNIFIED ROMIMAGE END */
8199c2b2975SHarish Zunjarrao 
8209c2b2975SHarish Zunjarrao #define QLA82XX_UNIFIED_ROMIMAGE	3
8219c2b2975SHarish Zunjarrao #define QLA82XX_FLASH_ROMIMAGE		4
8229c2b2975SHarish Zunjarrao #define QLA82XX_UNKNOWN_ROMIMAGE	0xff
823a9083016SGiridhar Malavali 
824a9083016SGiridhar Malavali #define MIU_TEST_AGT_WRDATA_UPPER_LO		(0x0b0)
825a9083016SGiridhar Malavali #define	MIU_TEST_AGT_WRDATA_UPPER_HI		(0x0b4)
826a9083016SGiridhar Malavali 
827a9083016SGiridhar Malavali /* Request and response queue size */
828a9083016SGiridhar Malavali #define REQUEST_ENTRY_CNT_82XX		128	/* Number of request entries. */
829a9083016SGiridhar Malavali #define RESPONSE_ENTRY_CNT_82XX		128	/* Number of response entries.*/
830a9083016SGiridhar Malavali 
831a9083016SGiridhar Malavali /*
832a9083016SGiridhar Malavali  * ISP 8021 I/O Register Set structure definitions.
833a9083016SGiridhar Malavali  */
834a9083016SGiridhar Malavali struct device_reg_82xx {
83521038b09SBart Van Assche 	__le32	req_q_out[64];		/* Request Queue out-Pointer (64 * 4) */
83621038b09SBart Van Assche 	__le32	rsp_q_in[64];		/* Response Queue In-Pointer. */
83721038b09SBart Van Assche 	__le32	rsp_q_out[64];		/* Response Queue Out-Pointer. */
838a9083016SGiridhar Malavali 
83921038b09SBart Van Assche 	__le16	mailbox_in[32];		/* Mailbox In registers */
84021038b09SBart Van Assche 	__le16	unused_1[32];
84121038b09SBart Van Assche 	__le32	hint;			/* Host interrupt register */
842a9083016SGiridhar Malavali #define	HINT_MBX_INT_PENDING	BIT_0
84321038b09SBart Van Assche 	__le16	unused_2[62];
84421038b09SBart Van Assche 	__le16	mailbox_out[32];	/* Mailbox Out registers */
84521038b09SBart Van Assche 	__le32	unused_3[48];
846a9083016SGiridhar Malavali 
84721038b09SBart Van Assche 	__le32	host_status;		/* host status */
848a9083016SGiridhar Malavali #define HSRX_RISC_INT		BIT_15	/* RISC to Host interrupt. */
849a9083016SGiridhar Malavali #define HSRX_RISC_PAUSED	BIT_8	/* RISC Paused. */
85021038b09SBart Van Assche 	__le32	host_int;		/* Interrupt status. */
851a9083016SGiridhar Malavali #define ISRX_NX_RISC_INT	BIT_0	/* RISC interrupt. */
852a9083016SGiridhar Malavali };
853a9083016SGiridhar Malavali 
854a9083016SGiridhar Malavali struct fcp_cmnd {
855a9083016SGiridhar Malavali 	struct scsi_lun lun;
856a9083016SGiridhar Malavali 	uint8_t crn;
857a9083016SGiridhar Malavali 	uint8_t task_attribute;
85865155b37SUwe Kleine-König 	uint8_t task_management;
859a9083016SGiridhar Malavali 	uint8_t additional_cdb_len;
860*ae25f65aSQuinn Tran #define QLA_CDB_BUF_SIZE  256
861*ae25f65aSQuinn Tran #define QLA_FCP_DL_SIZE   4
862*ae25f65aSQuinn Tran 	uint8_t cdb[QLA_CDB_BUF_SIZE + QLA_FCP_DL_SIZE]; /* 256 for CDB len and 4 for FCP_DL */
863a9083016SGiridhar Malavali };
864a9083016SGiridhar Malavali 
865a9083016SGiridhar Malavali struct dsd_dma {
866a9083016SGiridhar Malavali 	struct list_head list;
867a9083016SGiridhar Malavali 	dma_addr_t dsd_list_dma;
868a9083016SGiridhar Malavali 	void *dsd_addr;
869a9083016SGiridhar Malavali };
870a9083016SGiridhar Malavali 
871a9083016SGiridhar Malavali #define QLA_DSDS_PER_IOCB	37
872a9083016SGiridhar Malavali #define QLA_DSD_SIZE		12
873a9083016SGiridhar Malavali struct ct6_dsd {
874a9083016SGiridhar Malavali 	uint16_t fcp_cmnd_len;
875a9083016SGiridhar Malavali 	dma_addr_t fcp_cmnd_dma;
876a9083016SGiridhar Malavali 	struct fcp_cmnd *fcp_cmnd;
877a9083016SGiridhar Malavali 	int dsd_use_cnt;
878a9083016SGiridhar Malavali 	struct list_head dsd_list;
879a9083016SGiridhar Malavali };
880a9083016SGiridhar Malavali 
8813711333dSGiridhar Malavali #define MBC_TOGGLE_INTERRUPT	0x10
8826246b8a1SGiridhar Malavali #define MBC_SET_LED_CONFIG	0x125	/* FCoE specific LED control */
8836246b8a1SGiridhar Malavali #define MBC_GET_LED_CONFIG	0x126	/* FCoE specific LED control */
884a9083016SGiridhar Malavali 
885a9083016SGiridhar Malavali /* Flash  offset */
886a9083016SGiridhar Malavali #define FLT_REG_BOOTLOAD_82XX	0x72
887a9083016SGiridhar Malavali #define FLT_REG_BOOT_CODE_82XX	0x78
888a9083016SGiridhar Malavali #define FLT_REG_FW_82XX		0x74
889a9083016SGiridhar Malavali #define FLT_REG_GOLD_FW_82XX	0x75
890a865c50aSSaurav Kashyap #define FLT_REG_VPD_8XXX	0x81
891a9083016SGiridhar Malavali 
892a9083016SGiridhar Malavali #define	FA_VPD_SIZE_82XX	0x400
893a9083016SGiridhar Malavali 
894a9083016SGiridhar Malavali #define FA_FLASH_LAYOUT_ADDR_82	0xFC400
895a9083016SGiridhar Malavali 
896a9083016SGiridhar Malavali /******************************************************************************
897a9083016SGiridhar Malavali *
898a9083016SGiridhar Malavali *    Definitions specific to M25P flash
899a9083016SGiridhar Malavali *
900a9083016SGiridhar Malavali *******************************************************************************
901a9083016SGiridhar Malavali *   Instructions
902a9083016SGiridhar Malavali */
903a9083016SGiridhar Malavali #define M25P_INSTR_WREN		0x06
904a9083016SGiridhar Malavali #define M25P_INSTR_WRDI		0x04
905a9083016SGiridhar Malavali #define M25P_INSTR_RDID		0x9f
906a9083016SGiridhar Malavali #define M25P_INSTR_RDSR		0x05
907a9083016SGiridhar Malavali #define M25P_INSTR_WRSR		0x01
908a9083016SGiridhar Malavali #define M25P_INSTR_READ		0x03
909a9083016SGiridhar Malavali #define M25P_INSTR_FAST_READ	0x0b
910a9083016SGiridhar Malavali #define M25P_INSTR_PP		0x02
911a9083016SGiridhar Malavali #define M25P_INSTR_SE		0xd8
912a9083016SGiridhar Malavali #define M25P_INSTR_BE		0xc7
913a9083016SGiridhar Malavali #define M25P_INSTR_DP		0xb9
914a9083016SGiridhar Malavali #define M25P_INSTR_RES		0xab
915a9083016SGiridhar Malavali 
91608de2844SGiridhar Malavali /* Minidump related */
91708de2844SGiridhar Malavali 
91808de2844SGiridhar Malavali /*
91908de2844SGiridhar Malavali  * Version of the template
92008de2844SGiridhar Malavali  * 4 Bytes
92108de2844SGiridhar Malavali  * X.Major.Minor.RELEASE
92208de2844SGiridhar Malavali  */
92308de2844SGiridhar Malavali #define QLA82XX_MINIDUMP_VERSION         0x10101
92408de2844SGiridhar Malavali 
92508de2844SGiridhar Malavali /*
92608de2844SGiridhar Malavali  * Entry Type Defines
92708de2844SGiridhar Malavali  */
92808de2844SGiridhar Malavali #define QLA82XX_RDNOP                   0
92908de2844SGiridhar Malavali #define QLA82XX_RDCRB                   1
93008de2844SGiridhar Malavali #define QLA82XX_RDMUX                   2
93108de2844SGiridhar Malavali #define QLA82XX_QUEUE                   3
93208de2844SGiridhar Malavali #define QLA82XX_BOARD                   4
93308de2844SGiridhar Malavali #define QLA82XX_RDSRE                   5
93408de2844SGiridhar Malavali #define QLA82XX_RDOCM                   6
93508de2844SGiridhar Malavali #define QLA82XX_CACHE                  10
93608de2844SGiridhar Malavali #define QLA82XX_L1DAT                  11
93708de2844SGiridhar Malavali #define QLA82XX_L1INS                  12
93808de2844SGiridhar Malavali #define QLA82XX_L2DTG                  21
93908de2844SGiridhar Malavali #define QLA82XX_L2ITG                  22
94008de2844SGiridhar Malavali #define QLA82XX_L2DAT                  23
94108de2844SGiridhar Malavali #define QLA82XX_L2INS                  24
94208de2844SGiridhar Malavali #define QLA82XX_RDROM                  71
94308de2844SGiridhar Malavali #define QLA82XX_RDMEM                  72
94408de2844SGiridhar Malavali #define QLA82XX_CNTRL                  98
94508de2844SGiridhar Malavali #define QLA82XX_TLHDR                  99
94608de2844SGiridhar Malavali #define QLA82XX_RDEND                  255
9477ec0effdSAtul Deshmukh #define QLA8044_POLLRD			35
9487ec0effdSAtul Deshmukh #define QLA8044_RDMUX2			36
9497ec0effdSAtul Deshmukh #define QLA8044_L1DTG			8
9507ec0effdSAtul Deshmukh #define QLA8044_L1ITG			9
9517ec0effdSAtul Deshmukh #define QLA8044_POLLRDMWR		37
95208de2844SGiridhar Malavali 
95308de2844SGiridhar Malavali /*
95408de2844SGiridhar Malavali  * Opcodes for Control Entries.
95508de2844SGiridhar Malavali  * These Flags are bit fields.
95608de2844SGiridhar Malavali  */
95708de2844SGiridhar Malavali #define QLA82XX_DBG_OPCODE_WR        0x01
95808de2844SGiridhar Malavali #define QLA82XX_DBG_OPCODE_RW        0x02
95908de2844SGiridhar Malavali #define QLA82XX_DBG_OPCODE_AND       0x04
96008de2844SGiridhar Malavali #define QLA82XX_DBG_OPCODE_OR        0x08
96108de2844SGiridhar Malavali #define QLA82XX_DBG_OPCODE_POLL      0x10
96208de2844SGiridhar Malavali #define QLA82XX_DBG_OPCODE_RDSTATE   0x20
96308de2844SGiridhar Malavali #define QLA82XX_DBG_OPCODE_WRSTATE   0x40
96408de2844SGiridhar Malavali #define QLA82XX_DBG_OPCODE_MDSTATE   0x80
96508de2844SGiridhar Malavali 
96608de2844SGiridhar Malavali /*
96708de2844SGiridhar Malavali  * Template Header and Entry Header definitions start here.
96808de2844SGiridhar Malavali  */
96908de2844SGiridhar Malavali 
97008de2844SGiridhar Malavali /*
97108de2844SGiridhar Malavali  * Template Header
97208de2844SGiridhar Malavali  * Parts of the template header can be modified by the driver.
97308de2844SGiridhar Malavali  * These include the saved_state_array, capture_debug_level, driver_timestamp
97408de2844SGiridhar Malavali  */
97508de2844SGiridhar Malavali 
97608de2844SGiridhar Malavali #define QLA82XX_DBG_STATE_ARRAY_LEN        16
97708de2844SGiridhar Malavali #define QLA82XX_DBG_CAP_SIZE_ARRAY_LEN     8
97808de2844SGiridhar Malavali #define QLA82XX_DBG_RSVD_ARRAY_LEN         8
97908de2844SGiridhar Malavali 
98008de2844SGiridhar Malavali /*
98108de2844SGiridhar Malavali  * Driver Flags
98208de2844SGiridhar Malavali  */
98308de2844SGiridhar Malavali #define QLA82XX_DBG_SKIPPED_FLAG	0x80	/* driver skipped this entry */
98408de2844SGiridhar Malavali #define	QLA82XX_DEFAULT_CAP_MASK	0xFF	/* default capture mask */
98508de2844SGiridhar Malavali 
98608de2844SGiridhar Malavali struct qla82xx_md_template_hdr {
98708de2844SGiridhar Malavali 	uint32_t entry_type;
98808de2844SGiridhar Malavali 	uint32_t first_entry_offset;
98908de2844SGiridhar Malavali 	uint32_t size_of_template;
99008de2844SGiridhar Malavali 	uint32_t capture_debug_level;
99108de2844SGiridhar Malavali 
99208de2844SGiridhar Malavali 	uint32_t num_of_entries;
99308de2844SGiridhar Malavali 	uint32_t version;
99408de2844SGiridhar Malavali 	uint32_t driver_timestamp;
99508de2844SGiridhar Malavali 	uint32_t template_checksum;
99608de2844SGiridhar Malavali 
99708de2844SGiridhar Malavali 	uint32_t driver_capture_mask;
99808de2844SGiridhar Malavali 	uint32_t driver_info[3];
99908de2844SGiridhar Malavali 
100008de2844SGiridhar Malavali 	uint32_t saved_state_array[QLA82XX_DBG_STATE_ARRAY_LEN];
100108de2844SGiridhar Malavali 	uint32_t capture_size_array[QLA82XX_DBG_CAP_SIZE_ARRAY_LEN];
100208de2844SGiridhar Malavali 
100308de2844SGiridhar Malavali 	/*  markers_array used to capture some special locations on board */
100408de2844SGiridhar Malavali 	uint32_t markers_array[QLA82XX_DBG_RSVD_ARRAY_LEN];
100508de2844SGiridhar Malavali 	uint32_t num_of_free_entries;	/* For internal use */
100608de2844SGiridhar Malavali 	uint32_t free_entry_offset;	/* For internal use */
100708de2844SGiridhar Malavali 	uint32_t total_table_size;	/*  For internal use */
100808de2844SGiridhar Malavali 	uint32_t bkup_table_offset;	/*  For internal use */
100908de2844SGiridhar Malavali } __packed;
101008de2844SGiridhar Malavali 
101108de2844SGiridhar Malavali /*
101208de2844SGiridhar Malavali  * Entry Header:  Common to All Entry Types
101308de2844SGiridhar Malavali  */
101408de2844SGiridhar Malavali 
101508de2844SGiridhar Malavali /*
101608de2844SGiridhar Malavali  * Driver Code is for driver to write some info about the entry.
101708de2844SGiridhar Malavali  * Currently not used.
101808de2844SGiridhar Malavali  */
101908de2844SGiridhar Malavali typedef struct qla82xx_md_entry_hdr {
102008de2844SGiridhar Malavali 	uint32_t entry_type;
102108de2844SGiridhar Malavali 	uint32_t entry_size;
102208de2844SGiridhar Malavali 	uint32_t entry_capture_size;
102308de2844SGiridhar Malavali 	struct {
102408de2844SGiridhar Malavali 		uint8_t entry_capture_mask;
102508de2844SGiridhar Malavali 		uint8_t entry_code;
102608de2844SGiridhar Malavali 		uint8_t driver_code;
102708de2844SGiridhar Malavali 		uint8_t driver_flags;
102808de2844SGiridhar Malavali 	} d_ctrl;
102908de2844SGiridhar Malavali } __packed qla82xx_md_entry_hdr_t;
103008de2844SGiridhar Malavali 
103108de2844SGiridhar Malavali /*
103208de2844SGiridhar Malavali  *  Read CRB entry header
103308de2844SGiridhar Malavali  */
103408de2844SGiridhar Malavali struct qla82xx_md_entry_crb {
103508de2844SGiridhar Malavali 	qla82xx_md_entry_hdr_t h;
103608de2844SGiridhar Malavali 	uint32_t addr;
103708de2844SGiridhar Malavali 	struct {
103808de2844SGiridhar Malavali 		uint8_t addr_stride;
103908de2844SGiridhar Malavali 		uint8_t state_index_a;
104008de2844SGiridhar Malavali 		uint16_t poll_timeout;
104108de2844SGiridhar Malavali 	} crb_strd;
104208de2844SGiridhar Malavali 
104308de2844SGiridhar Malavali 	uint32_t data_size;
104408de2844SGiridhar Malavali 	uint32_t op_count;
104508de2844SGiridhar Malavali 
104608de2844SGiridhar Malavali 	struct {
104708de2844SGiridhar Malavali 		uint8_t opcode;
104808de2844SGiridhar Malavali 		uint8_t state_index_v;
104908de2844SGiridhar Malavali 		uint8_t shl;
105008de2844SGiridhar Malavali 		uint8_t shr;
105108de2844SGiridhar Malavali 	} crb_ctrl;
105208de2844SGiridhar Malavali 
105308de2844SGiridhar Malavali 	uint32_t value_1;
105408de2844SGiridhar Malavali 	uint32_t value_2;
105508de2844SGiridhar Malavali 	uint32_t value_3;
105608de2844SGiridhar Malavali } __packed;
105708de2844SGiridhar Malavali 
105808de2844SGiridhar Malavali /*
105908de2844SGiridhar Malavali  * Cache entry header
106008de2844SGiridhar Malavali  */
106108de2844SGiridhar Malavali struct qla82xx_md_entry_cache {
106208de2844SGiridhar Malavali 	qla82xx_md_entry_hdr_t h;
106308de2844SGiridhar Malavali 
106408de2844SGiridhar Malavali 	uint32_t tag_reg_addr;
106508de2844SGiridhar Malavali 	struct {
106608de2844SGiridhar Malavali 		uint16_t tag_value_stride;
106708de2844SGiridhar Malavali 		uint16_t init_tag_value;
106808de2844SGiridhar Malavali 	} addr_ctrl;
106908de2844SGiridhar Malavali 
107008de2844SGiridhar Malavali 	uint32_t data_size;
107108de2844SGiridhar Malavali 	uint32_t op_count;
107208de2844SGiridhar Malavali 
107308de2844SGiridhar Malavali 	uint32_t control_addr;
107408de2844SGiridhar Malavali 	struct {
107508de2844SGiridhar Malavali 		uint16_t write_value;
107608de2844SGiridhar Malavali 		uint8_t poll_mask;
107708de2844SGiridhar Malavali 		uint8_t poll_wait;
107808de2844SGiridhar Malavali 	} cache_ctrl;
107908de2844SGiridhar Malavali 
108008de2844SGiridhar Malavali 	uint32_t read_addr;
108108de2844SGiridhar Malavali 	struct {
108208de2844SGiridhar Malavali 		uint8_t read_addr_stride;
108308de2844SGiridhar Malavali 		uint8_t read_addr_cnt;
108408de2844SGiridhar Malavali 		uint16_t rsvd_1;
108508de2844SGiridhar Malavali 	} read_ctrl;
108608de2844SGiridhar Malavali } __packed;
108708de2844SGiridhar Malavali 
108808de2844SGiridhar Malavali /*
108908de2844SGiridhar Malavali  * Read OCM
109008de2844SGiridhar Malavali  */
109108de2844SGiridhar Malavali struct qla82xx_md_entry_rdocm {
109208de2844SGiridhar Malavali 	qla82xx_md_entry_hdr_t h;
109308de2844SGiridhar Malavali 
109408de2844SGiridhar Malavali 	uint32_t rsvd_0;
109508de2844SGiridhar Malavali 	uint32_t rsvd_1;
109608de2844SGiridhar Malavali 	uint32_t data_size;
109708de2844SGiridhar Malavali 	uint32_t op_count;
109808de2844SGiridhar Malavali 
109908de2844SGiridhar Malavali 	uint32_t rsvd_2;
110008de2844SGiridhar Malavali 	uint32_t rsvd_3;
110108de2844SGiridhar Malavali 	uint32_t read_addr;
110208de2844SGiridhar Malavali 	uint32_t read_addr_stride;
110308de2844SGiridhar Malavali 	uint32_t read_addr_cntrl;
110408de2844SGiridhar Malavali } __packed;
110508de2844SGiridhar Malavali 
110608de2844SGiridhar Malavali /*
110708de2844SGiridhar Malavali  * Read Memory
110808de2844SGiridhar Malavali  */
110908de2844SGiridhar Malavali struct qla82xx_md_entry_rdmem {
111008de2844SGiridhar Malavali 	qla82xx_md_entry_hdr_t h;
111108de2844SGiridhar Malavali 	uint32_t rsvd[6];
111208de2844SGiridhar Malavali 	uint32_t read_addr;
111308de2844SGiridhar Malavali 	uint32_t read_data_size;
111408de2844SGiridhar Malavali } __packed;
111508de2844SGiridhar Malavali 
111608de2844SGiridhar Malavali /*
111708de2844SGiridhar Malavali  * Read ROM
111808de2844SGiridhar Malavali  */
111908de2844SGiridhar Malavali struct qla82xx_md_entry_rdrom {
112008de2844SGiridhar Malavali 	qla82xx_md_entry_hdr_t h;
112108de2844SGiridhar Malavali 	uint32_t rsvd[6];
112208de2844SGiridhar Malavali 	uint32_t read_addr;
112308de2844SGiridhar Malavali 	uint32_t read_data_size;
112408de2844SGiridhar Malavali } __packed;
112508de2844SGiridhar Malavali 
112608de2844SGiridhar Malavali struct qla82xx_md_entry_mux {
112708de2844SGiridhar Malavali 	qla82xx_md_entry_hdr_t h;
112808de2844SGiridhar Malavali 
112908de2844SGiridhar Malavali 	uint32_t select_addr;
113008de2844SGiridhar Malavali 	uint32_t rsvd_0;
113108de2844SGiridhar Malavali 	uint32_t data_size;
113208de2844SGiridhar Malavali 	uint32_t op_count;
113308de2844SGiridhar Malavali 
113408de2844SGiridhar Malavali 	uint32_t select_value;
113508de2844SGiridhar Malavali 	uint32_t select_value_stride;
113608de2844SGiridhar Malavali 	uint32_t read_addr;
113708de2844SGiridhar Malavali 	uint32_t rsvd_1;
113808de2844SGiridhar Malavali } __packed;
113908de2844SGiridhar Malavali 
114008de2844SGiridhar Malavali struct qla82xx_md_entry_queue {
114108de2844SGiridhar Malavali 	qla82xx_md_entry_hdr_t h;
114208de2844SGiridhar Malavali 
114308de2844SGiridhar Malavali 	uint32_t select_addr;
114408de2844SGiridhar Malavali 	struct {
114508de2844SGiridhar Malavali 		uint16_t queue_id_stride;
114608de2844SGiridhar Malavali 		uint16_t rsvd_0;
114708de2844SGiridhar Malavali 	} q_strd;
114808de2844SGiridhar Malavali 
114908de2844SGiridhar Malavali 	uint32_t data_size;
115008de2844SGiridhar Malavali 	uint32_t op_count;
115108de2844SGiridhar Malavali 	uint32_t rsvd_1;
115208de2844SGiridhar Malavali 	uint32_t rsvd_2;
115308de2844SGiridhar Malavali 
115408de2844SGiridhar Malavali 	uint32_t read_addr;
115508de2844SGiridhar Malavali 	struct {
115608de2844SGiridhar Malavali 		uint8_t read_addr_stride;
115708de2844SGiridhar Malavali 		uint8_t read_addr_cnt;
115808de2844SGiridhar Malavali 		uint16_t rsvd_3;
115908de2844SGiridhar Malavali 	} rd_strd;
116008de2844SGiridhar Malavali } __packed;
116108de2844SGiridhar Malavali 
116208de2844SGiridhar Malavali #define MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE 0x129
116308de2844SGiridhar Malavali #define RQST_TMPLT_SIZE	0x0
116408de2844SGiridhar Malavali #define RQST_TMPLT 0x1
116508de2844SGiridhar Malavali #define MD_DIRECT_ROM_WINDOW	0x42110030
116608de2844SGiridhar Malavali #define MD_DIRECT_ROM_READ_BASE	0x42150000
116708de2844SGiridhar Malavali #define MD_MIU_TEST_AGT_CTRL		0x41000090
116808de2844SGiridhar Malavali #define MD_MIU_TEST_AGT_ADDR_LO		0x41000094
116908de2844SGiridhar Malavali #define MD_MIU_TEST_AGT_ADDR_HI		0x41000098
117008de2844SGiridhar Malavali 
117161778a1cSBart Van Assche extern const int MD_MIU_TEST_AGT_RDDATA[4];
117263154916SGiridhar Malavali 
117363154916SGiridhar Malavali #define CRB_NIU_XG_PAUSE_CTL_P0        0x1
117463154916SGiridhar Malavali #define CRB_NIU_XG_PAUSE_CTL_P1        0x8
117563154916SGiridhar Malavali 
11765988aeb2SGiridhar Malavali #define qla82xx_get_temp_val(x)          ((x) >> 16)
11775988aeb2SGiridhar Malavali #define qla82xx_get_temp_state(x)        ((x) & 0xffff)
11785988aeb2SGiridhar Malavali #define qla82xx_encode_temp(val, state)  (((val) << 16) | (state))
11795988aeb2SGiridhar Malavali 
11805988aeb2SGiridhar Malavali /*
11815988aeb2SGiridhar Malavali  * Temperature control.
11825988aeb2SGiridhar Malavali  */
11835988aeb2SGiridhar Malavali enum {
11845988aeb2SGiridhar Malavali 	QLA82XX_TEMP_NORMAL = 0x1, /* Normal operating range */
11855988aeb2SGiridhar Malavali 	QLA82XX_TEMP_WARN,	   /* Sound alert, temperature getting high */
11865988aeb2SGiridhar Malavali 	QLA82XX_TEMP_PANIC	   /* Fatal error, hardware has shut down. */
11875988aeb2SGiridhar Malavali };
11887ec0effdSAtul Deshmukh 
11897ec0effdSAtul Deshmukh #define LEG_INTR_PTR_OFFSET	0x38C0
11907ec0effdSAtul Deshmukh #define LEG_INTR_TRIG_OFFSET	0x38C4
11917ec0effdSAtul Deshmukh #define LEG_INTR_MASK_OFFSET	0x38C8
1192a9083016SGiridhar Malavali #endif
1193