18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * QLogic iSCSI HBA Driver
48c2ecf20Sopenharmony_ci * Copyright (c)  2003-2013 QLogic Corporation
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef __QLA_NX_H
78c2ecf20Sopenharmony_ci#define __QLA_NX_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/*
108c2ecf20Sopenharmony_ci * Following are the states of the Phantom. Phantom will set them and
118c2ecf20Sopenharmony_ci * Host will read to check if the fields are correct.
128c2ecf20Sopenharmony_ci*/
138c2ecf20Sopenharmony_ci#define PHAN_INITIALIZE_FAILED		0xffff
148c2ecf20Sopenharmony_ci#define PHAN_INITIALIZE_COMPLETE	0xff01
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* Host writes the following to notify that it has done the init-handshake */
178c2ecf20Sopenharmony_ci#define PHAN_INITIALIZE_ACK		0xf00f
188c2ecf20Sopenharmony_ci#define PHAN_PEG_RCV_INITIALIZED	0xff01
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci/*CRB_RELATED*/
218c2ecf20Sopenharmony_ci#define QLA82XX_CRB_BASE		(QLA82XX_CAM_RAM(0x200))
228c2ecf20Sopenharmony_ci#define QLA82XX_REG(X)			(QLA82XX_CRB_BASE+(X))
238c2ecf20Sopenharmony_ci#define CRB_CMDPEG_STATE		QLA82XX_REG(0x50)
248c2ecf20Sopenharmony_ci#define CRB_RCVPEG_STATE		QLA82XX_REG(0x13c)
258c2ecf20Sopenharmony_ci#define CRB_DMA_SHIFT			QLA82XX_REG(0xcc)
268c2ecf20Sopenharmony_ci#define CRB_TEMP_STATE			QLA82XX_REG(0x1b4)
278c2ecf20Sopenharmony_ci#define CRB_CMDPEG_CHECK_RETRY_COUNT	60
288c2ecf20Sopenharmony_ci#define CRB_CMDPEG_CHECK_DELAY		500
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define qla82xx_get_temp_val(x)		((x) >> 16)
318c2ecf20Sopenharmony_ci#define qla82xx_get_temp_state(x)	((x) & 0xffff)
328c2ecf20Sopenharmony_ci#define qla82xx_encode_temp(val, state)	(((val) << 16) | (state))
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/*
358c2ecf20Sopenharmony_ci * Temperature control.
368c2ecf20Sopenharmony_ci */
378c2ecf20Sopenharmony_cienum {
388c2ecf20Sopenharmony_ci	QLA82XX_TEMP_NORMAL = 0x1,	/* Normal operating range */
398c2ecf20Sopenharmony_ci	QLA82XX_TEMP_WARN,	/* Sound alert, temperature getting high */
408c2ecf20Sopenharmony_ci	QLA82XX_TEMP_PANIC	/* Fatal error, hardware has shut down. */
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define CRB_NIU_XG_PAUSE_CTL_P0		0x1
448c2ecf20Sopenharmony_ci#define CRB_NIU_XG_PAUSE_CTL_P1		0x8
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define QLA82XX_HW_H0_CH_HUB_ADR	0x05
478c2ecf20Sopenharmony_ci#define QLA82XX_HW_H1_CH_HUB_ADR	0x0E
488c2ecf20Sopenharmony_ci#define QLA82XX_HW_H2_CH_HUB_ADR	0x03
498c2ecf20Sopenharmony_ci#define QLA82XX_HW_H3_CH_HUB_ADR	0x01
508c2ecf20Sopenharmony_ci#define QLA82XX_HW_H4_CH_HUB_ADR	0x06
518c2ecf20Sopenharmony_ci#define QLA82XX_HW_H5_CH_HUB_ADR	0x07
528c2ecf20Sopenharmony_ci#define QLA82XX_HW_H6_CH_HUB_ADR	0x08
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/*  Hub 0 */
558c2ecf20Sopenharmony_ci#define QLA82XX_HW_MN_CRB_AGT_ADR	0x15
568c2ecf20Sopenharmony_ci#define QLA82XX_HW_MS_CRB_AGT_ADR	0x25
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/*  Hub 1 */
598c2ecf20Sopenharmony_ci#define QLA82XX_HW_PS_CRB_AGT_ADR	0x73
608c2ecf20Sopenharmony_ci#define QLA82XX_HW_QMS_CRB_AGT_ADR	0x00
618c2ecf20Sopenharmony_ci#define QLA82XX_HW_RPMX3_CRB_AGT_ADR	0x0b
628c2ecf20Sopenharmony_ci#define QLA82XX_HW_SQGS0_CRB_AGT_ADR	0x01
638c2ecf20Sopenharmony_ci#define QLA82XX_HW_SQGS1_CRB_AGT_ADR	0x02
648c2ecf20Sopenharmony_ci#define QLA82XX_HW_SQGS2_CRB_AGT_ADR	0x03
658c2ecf20Sopenharmony_ci#define QLA82XX_HW_SQGS3_CRB_AGT_ADR	0x04
668c2ecf20Sopenharmony_ci#define QLA82XX_HW_C2C0_CRB_AGT_ADR	0x58
678c2ecf20Sopenharmony_ci#define QLA82XX_HW_C2C1_CRB_AGT_ADR	0x59
688c2ecf20Sopenharmony_ci#define QLA82XX_HW_C2C2_CRB_AGT_ADR	0x5a
698c2ecf20Sopenharmony_ci#define QLA82XX_HW_RPMX2_CRB_AGT_ADR	0x0a
708c2ecf20Sopenharmony_ci#define QLA82XX_HW_RPMX4_CRB_AGT_ADR	0x0c
718c2ecf20Sopenharmony_ci#define QLA82XX_HW_RPMX7_CRB_AGT_ADR	0x0f
728c2ecf20Sopenharmony_ci#define QLA82XX_HW_RPMX9_CRB_AGT_ADR	0x12
738c2ecf20Sopenharmony_ci#define QLA82XX_HW_SMB_CRB_AGT_ADR	0x18
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/*  Hub 2 */
768c2ecf20Sopenharmony_ci#define QLA82XX_HW_NIU_CRB_AGT_ADR	0x31
778c2ecf20Sopenharmony_ci#define QLA82XX_HW_I2C0_CRB_AGT_ADR	0x19
788c2ecf20Sopenharmony_ci#define QLA82XX_HW_I2C1_CRB_AGT_ADR	0x29
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define QLA82XX_HW_SN_CRB_AGT_ADR	0x10
818c2ecf20Sopenharmony_ci#define QLA82XX_HW_I2Q_CRB_AGT_ADR	0x20
828c2ecf20Sopenharmony_ci#define QLA82XX_HW_LPC_CRB_AGT_ADR	0x22
838c2ecf20Sopenharmony_ci#define QLA82XX_HW_ROMUSB_CRB_AGT_ADR   0x21
848c2ecf20Sopenharmony_ci#define QLA82XX_HW_QM_CRB_AGT_ADR	0x66
858c2ecf20Sopenharmony_ci#define QLA82XX_HW_SQG0_CRB_AGT_ADR	0x60
868c2ecf20Sopenharmony_ci#define QLA82XX_HW_SQG1_CRB_AGT_ADR	0x61
878c2ecf20Sopenharmony_ci#define QLA82XX_HW_SQG2_CRB_AGT_ADR	0x62
888c2ecf20Sopenharmony_ci#define QLA82XX_HW_SQG3_CRB_AGT_ADR	0x63
898c2ecf20Sopenharmony_ci#define QLA82XX_HW_RPMX1_CRB_AGT_ADR    0x09
908c2ecf20Sopenharmony_ci#define QLA82XX_HW_RPMX5_CRB_AGT_ADR    0x0d
918c2ecf20Sopenharmony_ci#define QLA82XX_HW_RPMX6_CRB_AGT_ADR    0x0e
928c2ecf20Sopenharmony_ci#define QLA82XX_HW_RPMX8_CRB_AGT_ADR    0x11
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/*  Hub 3 */
958c2ecf20Sopenharmony_ci#define QLA82XX_HW_PH_CRB_AGT_ADR	0x1A
968c2ecf20Sopenharmony_ci#define QLA82XX_HW_SRE_CRB_AGT_ADR	0x50
978c2ecf20Sopenharmony_ci#define QLA82XX_HW_EG_CRB_AGT_ADR	0x51
988c2ecf20Sopenharmony_ci#define QLA82XX_HW_RPMX0_CRB_AGT_ADR	0x08
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci/*  Hub 4 */
1018c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGN0_CRB_AGT_ADR	0x40
1028c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGN1_CRB_AGT_ADR	0x41
1038c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGN2_CRB_AGT_ADR	0x42
1048c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGN3_CRB_AGT_ADR	0x43
1058c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGNI_CRB_AGT_ADR	0x44
1068c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGND_CRB_AGT_ADR	0x45
1078c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGNC_CRB_AGT_ADR	0x46
1088c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGR0_CRB_AGT_ADR	0x47
1098c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGR1_CRB_AGT_ADR	0x48
1108c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGR2_CRB_AGT_ADR	0x49
1118c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGR3_CRB_AGT_ADR	0x4a
1128c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGN4_CRB_AGT_ADR	0x4b
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/*  Hub 5 */
1158c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGS0_CRB_AGT_ADR	0x40
1168c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGS1_CRB_AGT_ADR	0x41
1178c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGS2_CRB_AGT_ADR	0x42
1188c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGS3_CRB_AGT_ADR	0x43
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGSI_CRB_AGT_ADR	0x44
1218c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGSD_CRB_AGT_ADR	0x45
1228c2ecf20Sopenharmony_ci#define QLA82XX_HW_PEGSC_CRB_AGT_ADR	0x46
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci/*  Hub 6 */
1258c2ecf20Sopenharmony_ci#define QLA82XX_HW_CAS0_CRB_AGT_ADR	0x46
1268c2ecf20Sopenharmony_ci#define QLA82XX_HW_CAS1_CRB_AGT_ADR	0x47
1278c2ecf20Sopenharmony_ci#define QLA82XX_HW_CAS2_CRB_AGT_ADR	0x48
1288c2ecf20Sopenharmony_ci#define QLA82XX_HW_CAS3_CRB_AGT_ADR	0x49
1298c2ecf20Sopenharmony_ci#define QLA82XX_HW_NCM_CRB_AGT_ADR	0x16
1308c2ecf20Sopenharmony_ci#define QLA82XX_HW_TMR_CRB_AGT_ADR	0x17
1318c2ecf20Sopenharmony_ci#define QLA82XX_HW_XDMA_CRB_AGT_ADR	0x05
1328c2ecf20Sopenharmony_ci#define QLA82XX_HW_OCM0_CRB_AGT_ADR	0x06
1338c2ecf20Sopenharmony_ci#define QLA82XX_HW_OCM1_CRB_AGT_ADR	0x07
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/*  This field defines PCI/X adr [25:20] of agents on the CRB */
1368c2ecf20Sopenharmony_ci/*  */
1378c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PH	0
1388c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PS	1
1398c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_MN	2
1408c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_MS	3
1418c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SRE	5
1428c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_NIU	6
1438c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_QMN	7
1448c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQN0	8
1458c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQN1	9
1468c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQN2	10
1478c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQN3	11
1488c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_QMS	12
1498c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQS0	13
1508c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQS1	14
1518c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQS2	15
1528c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQS3	16
1538c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGN0	17
1548c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGN1	18
1558c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGN2	19
1568c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGN3	20
1578c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGN4	QLA82XX_HW_PX_MAP_CRB_SQS2
1588c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGND	21
1598c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGNI	22
1608c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGS0	23
1618c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGS1	24
1628c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGS2	25
1638c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGS3	26
1648c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGSD	27
1658c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGSI	28
1668c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SN	29
1678c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_EG	31
1688c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PH2	32
1698c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PS2	33
1708c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_CAM	34
1718c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_CAS0	35
1728c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_CAS1	36
1738c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_CAS2	37
1748c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_C2C0	38
1758c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_C2C1	39
1768c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_TIMR	40
1778c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX1	42
1788c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX2	43
1798c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX3	44
1808c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX4	45
1818c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX5	46
1828c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX6	47
1838c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX7	48
1848c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_XDMA	49
1858c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_I2Q	50
1868c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_ROMUSB    51
1878c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_CAS3	52
1888c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX0	53
1898c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX8	54
1908c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX9	55
1918c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_OCM0	56
1928c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_OCM1	57
1938c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SMB	58
1948c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_I2C0	59
1958c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_I2C1	60
1968c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_LPC	61
1978c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGNC	62
1988c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGR0	63
1998c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGR1	4
2008c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGR2	30
2018c2ecf20Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGR3	41
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/*  This field defines CRB adr [31:20] of the agents */
2048c2ecf20Sopenharmony_ci/*  */
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_MN	((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
2078c2ecf20Sopenharmony_ci					QLA82XX_HW_MN_CRB_AGT_ADR)
2088c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PH	((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
2098c2ecf20Sopenharmony_ci					QLA82XX_HW_PH_CRB_AGT_ADR)
2108c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_MS	((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
2118c2ecf20Sopenharmony_ci					QLA82XX_HW_MS_CRB_AGT_ADR)
2128c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PS	((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2138c2ecf20Sopenharmony_ci					QLA82XX_HW_PS_CRB_AGT_ADR)
2148c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SS	((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2158c2ecf20Sopenharmony_ci					QLA82XX_HW_SS_CRB_AGT_ADR)
2168c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX3    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2178c2ecf20Sopenharmony_ci					    QLA82XX_HW_RPMX3_CRB_AGT_ADR)
2188c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_QMS	    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2198c2ecf20Sopenharmony_ci					    QLA82XX_HW_QMS_CRB_AGT_ADR)
2208c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS0     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2218c2ecf20Sopenharmony_ci					    QLA82XX_HW_SQGS0_CRB_AGT_ADR)
2228c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS1     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2238c2ecf20Sopenharmony_ci					    QLA82XX_HW_SQGS1_CRB_AGT_ADR)
2248c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS2     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2258c2ecf20Sopenharmony_ci					    QLA82XX_HW_SQGS2_CRB_AGT_ADR)
2268c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS3     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2278c2ecf20Sopenharmony_ci					    QLA82XX_HW_SQGS3_CRB_AGT_ADR)
2288c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_C2C0     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2298c2ecf20Sopenharmony_ci					    QLA82XX_HW_C2C0_CRB_AGT_ADR)
2308c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_C2C1     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2318c2ecf20Sopenharmony_ci					    QLA82XX_HW_C2C1_CRB_AGT_ADR)
2328c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX2    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2338c2ecf20Sopenharmony_ci					    QLA82XX_HW_RPMX2_CRB_AGT_ADR)
2348c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX4    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2358c2ecf20Sopenharmony_ci					    QLA82XX_HW_RPMX4_CRB_AGT_ADR)
2368c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX7    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2378c2ecf20Sopenharmony_ci					    QLA82XX_HW_RPMX7_CRB_AGT_ADR)
2388c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX9    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2398c2ecf20Sopenharmony_ci					    QLA82XX_HW_RPMX9_CRB_AGT_ADR)
2408c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SMB	    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
2418c2ecf20Sopenharmony_ci					    QLA82XX_HW_SMB_CRB_AGT_ADR)
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_NIU      ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
2448c2ecf20Sopenharmony_ci					    QLA82XX_HW_NIU_CRB_AGT_ADR)
2458c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_I2C0     ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
2468c2ecf20Sopenharmony_ci					    QLA82XX_HW_I2C0_CRB_AGT_ADR)
2478c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_I2C1     ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
2488c2ecf20Sopenharmony_ci					    QLA82XX_HW_I2C1_CRB_AGT_ADR)
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SRE      ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2518c2ecf20Sopenharmony_ci					    QLA82XX_HW_SRE_CRB_AGT_ADR)
2528c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_EG       ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2538c2ecf20Sopenharmony_ci					    QLA82XX_HW_EG_CRB_AGT_ADR)
2548c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX0    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2558c2ecf20Sopenharmony_ci					    QLA82XX_HW_RPMX0_CRB_AGT_ADR)
2568c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_QMN      ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2578c2ecf20Sopenharmony_ci					    QLA82XX_HW_QM_CRB_AGT_ADR)
2588c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN0     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2598c2ecf20Sopenharmony_ci					    QLA82XX_HW_SQG0_CRB_AGT_ADR)
2608c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN1     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2618c2ecf20Sopenharmony_ci					    QLA82XX_HW_SQG1_CRB_AGT_ADR)
2628c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN2     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2638c2ecf20Sopenharmony_ci					    QLA82XX_HW_SQG2_CRB_AGT_ADR)
2648c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN3     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2658c2ecf20Sopenharmony_ci					    QLA82XX_HW_SQG3_CRB_AGT_ADR)
2668c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX1    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2678c2ecf20Sopenharmony_ci					    QLA82XX_HW_RPMX1_CRB_AGT_ADR)
2688c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX5    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2698c2ecf20Sopenharmony_ci					    QLA82XX_HW_RPMX5_CRB_AGT_ADR)
2708c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX6    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2718c2ecf20Sopenharmony_ci					    QLA82XX_HW_RPMX6_CRB_AGT_ADR)
2728c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX8    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2738c2ecf20Sopenharmony_ci					    QLA82XX_HW_RPMX8_CRB_AGT_ADR)
2748c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS0     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2758c2ecf20Sopenharmony_ci					    QLA82XX_HW_CAS0_CRB_AGT_ADR)
2768c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS1     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2778c2ecf20Sopenharmony_ci					    QLA82XX_HW_CAS1_CRB_AGT_ADR)
2788c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS2     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2798c2ecf20Sopenharmony_ci					    QLA82XX_HW_CAS2_CRB_AGT_ADR)
2808c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS3     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
2818c2ecf20Sopenharmony_ci					    QLA82XX_HW_CAS3_CRB_AGT_ADR)
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGNI     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
2848c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGNI_CRB_AGT_ADR)
2858c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGND     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
2868c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGND_CRB_AGT_ADR)
2878c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN0     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
2888c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGN0_CRB_AGT_ADR)
2898c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN1     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
2908c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGN1_CRB_AGT_ADR)
2918c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN2     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
2928c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGN2_CRB_AGT_ADR)
2938c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN3     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
2948c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGN3_CRB_AGT_ADR)
2958c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN4     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
2968c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGN4_CRB_AGT_ADR)
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGNC     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
2998c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGNC_CRB_AGT_ADR)
3008c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR0     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
3018c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGR0_CRB_AGT_ADR)
3028c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR1     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
3038c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGR1_CRB_AGT_ADR)
3048c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR2     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
3058c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGR2_CRB_AGT_ADR)
3068c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR3     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
3078c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGR3_CRB_AGT_ADR)
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSI     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
3108c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGSI_CRB_AGT_ADR)
3118c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSD     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
3128c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGSD_CRB_AGT_ADR)
3138c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS0     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
3148c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGS0_CRB_AGT_ADR)
3158c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS1     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
3168c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGS1_CRB_AGT_ADR)
3178c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS2     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
3188c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGS2_CRB_AGT_ADR)
3198c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS3     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
3208c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGS3_CRB_AGT_ADR)
3218c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSC     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
3228c2ecf20Sopenharmony_ci					    QLA82XX_HW_PEGSC_CRB_AGT_ADR)
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAM      ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
3258c2ecf20Sopenharmony_ci					    QLA82XX_HW_NCM_CRB_AGT_ADR)
3268c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_TIMR     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
3278c2ecf20Sopenharmony_ci					    QLA82XX_HW_TMR_CRB_AGT_ADR)
3288c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_XDMA     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
3298c2ecf20Sopenharmony_ci					    QLA82XX_HW_XDMA_CRB_AGT_ADR)
3308c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SN       ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
3318c2ecf20Sopenharmony_ci					    QLA82XX_HW_SN_CRB_AGT_ADR)
3328c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_I2Q      ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
3338c2ecf20Sopenharmony_ci					    QLA82XX_HW_I2Q_CRB_AGT_ADR)
3348c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_ROMUSB   ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
3358c2ecf20Sopenharmony_ci					    QLA82XX_HW_ROMUSB_CRB_AGT_ADR)
3368c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_OCM0     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
3378c2ecf20Sopenharmony_ci					    QLA82XX_HW_OCM0_CRB_AGT_ADR)
3388c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_OCM1     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
3398c2ecf20Sopenharmony_ci					    QLA82XX_HW_OCM1_CRB_AGT_ADR)
3408c2ecf20Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_LPC      ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
3418c2ecf20Sopenharmony_ci					    QLA82XX_HW_LPC_CRB_AGT_ADR)
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci#define ROMUSB_GLB	(QLA82XX_CRB_ROMUSB + 0x00000)
3448c2ecf20Sopenharmony_ci#define QLA82XX_ROMUSB_GLB_PEGTUNE_DONE		(ROMUSB_GLB + 0x005c)
3458c2ecf20Sopenharmony_ci#define QLA82XX_ROMUSB_GLB_STATUS		(ROMUSB_GLB + 0x0004)
3468c2ecf20Sopenharmony_ci#define QLA82XX_ROMUSB_GLB_SW_RESET		(ROMUSB_GLB + 0x0008)
3478c2ecf20Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_ADDRESS		(ROMUSB_ROM + 0x0008)
3488c2ecf20Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_WDATA		(ROMUSB_ROM + 0x000c)
3498c2ecf20Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_ABYTE_CNT		(ROMUSB_ROM + 0x0010)
3508c2ecf20Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_DUMMY_BYTE_CNT	(ROMUSB_ROM + 0x0014)
3518c2ecf20Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_RDATA		(ROMUSB_ROM + 0x0018)
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci#define ROMUSB_ROM	(QLA82XX_CRB_ROMUSB + 0x10000)
3548c2ecf20Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_INSTR_OPCODE	(ROMUSB_ROM + 0x0004)
3558c2ecf20Sopenharmony_ci#define QLA82XX_ROMUSB_GLB_CAS_RST	(ROMUSB_GLB + 0x0038)
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci/* Lock IDs for ROM lock */
3588c2ecf20Sopenharmony_ci#define ROM_LOCK_DRIVER		0x0d417340
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci#define QLA82XX_PCI_CRB_WINDOWSIZE	0x00100000    /* all are 1MB windows */
3618c2ecf20Sopenharmony_ci#define QLA82XX_PCI_CRB_WINDOW(A)	(QLA82XX_PCI_CRBSPACE + \
3628c2ecf20Sopenharmony_ci					(A)*QLA82XX_PCI_CRB_WINDOWSIZE)
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci#define QLA82XX_CRB_C2C_0 \
3658c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C0)
3668c2ecf20Sopenharmony_ci#define QLA82XX_CRB_C2C_1 \
3678c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C1)
3688c2ecf20Sopenharmony_ci#define QLA82XX_CRB_C2C_2 \
3698c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C2)
3708c2ecf20Sopenharmony_ci#define QLA82XX_CRB_CAM	\
3718c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAM)
3728c2ecf20Sopenharmony_ci#define QLA82XX_CRB_CASPER \
3738c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS)
3748c2ecf20Sopenharmony_ci#define QLA82XX_CRB_CASPER_0 \
3758c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS0)
3768c2ecf20Sopenharmony_ci#define QLA82XX_CRB_CASPER_1 \
3778c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS1)
3788c2ecf20Sopenharmony_ci#define QLA82XX_CRB_CASPER_2 \
3798c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS2)
3808c2ecf20Sopenharmony_ci#define QLA82XX_CRB_DDR_MD \
3818c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_MS)
3828c2ecf20Sopenharmony_ci#define QLA82XX_CRB_DDR_NET \
3838c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_MN)
3848c2ecf20Sopenharmony_ci#define QLA82XX_CRB_EPG \
3858c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_EG)
3868c2ecf20Sopenharmony_ci#define QLA82XX_CRB_I2Q \
3878c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2Q)
3888c2ecf20Sopenharmony_ci#define QLA82XX_CRB_NIU	\
3898c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_NIU)
3908c2ecf20Sopenharmony_ci/* HACK upon HACK upon HACK (for PCIE builds) */
3918c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PCIX_HOST \
3928c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PH)
3938c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PCIX_HOST2 \
3948c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PH2)
3958c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PCIX_MD \
3968c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PS)
3978c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PCIE	QLA82XX_CRB_PCIX_MD
3988c2ecf20Sopenharmony_ci/* window 1 pcie slot */
3998c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PCIE2 \
4008c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PS2)
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_0 \
4038c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS0)
4048c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_1 \
4058c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS1)
4068c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_2 \
4078c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS2)
4088c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_3 \
4098c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS3)
4108c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_3 \
4118c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS3)
4128c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_D \
4138c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGSD)
4148c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_I \
4158c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGSI)
4168c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_0 \
4178c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN0)
4188c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_1 \
4198c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN1)
4208c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_2 \
4218c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN2)
4228c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_3 \
4238c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN3)
4248c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_4 \
4258c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN4)
4268c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_D \
4278c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGND)
4288c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_I \
4298c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGNI)
4308c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PQM_MD \
4318c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_QMS)
4328c2ecf20Sopenharmony_ci#define QLA82XX_CRB_PQM_NET \
4338c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_QMN)
4348c2ecf20Sopenharmony_ci#define QLA82XX_CRB_QDR_MD \
4358c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SS)
4368c2ecf20Sopenharmony_ci#define QLA82XX_CRB_QDR_NET \
4378c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SN)
4388c2ecf20Sopenharmony_ci#define QLA82XX_CRB_ROMUSB \
4398c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_ROMUSB)
4408c2ecf20Sopenharmony_ci#define QLA82XX_CRB_RPMX_0 \
4418c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX0)
4428c2ecf20Sopenharmony_ci#define QLA82XX_CRB_RPMX_1 \
4438c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX1)
4448c2ecf20Sopenharmony_ci#define QLA82XX_CRB_RPMX_2 \
4458c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX2)
4468c2ecf20Sopenharmony_ci#define QLA82XX_CRB_RPMX_3 \
4478c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX3)
4488c2ecf20Sopenharmony_ci#define QLA82XX_CRB_RPMX_4 \
4498c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX4)
4508c2ecf20Sopenharmony_ci#define QLA82XX_CRB_RPMX_5 \
4518c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX5)
4528c2ecf20Sopenharmony_ci#define QLA82XX_CRB_RPMX_6 \
4538c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX6)
4548c2ecf20Sopenharmony_ci#define QLA82XX_CRB_RPMX_7 \
4558c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX7)
4568c2ecf20Sopenharmony_ci#define QLA82XX_CRB_SQM_MD_0 \
4578c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS0)
4588c2ecf20Sopenharmony_ci#define QLA82XX_CRB_SQM_MD_1 \
4598c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS1)
4608c2ecf20Sopenharmony_ci#define QLA82XX_CRB_SQM_MD_2 \
4618c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS2)
4628c2ecf20Sopenharmony_ci#define QLA82XX_CRB_SQM_MD_3 \
4638c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS3)
4648c2ecf20Sopenharmony_ci#define QLA82XX_CRB_SQM_NET_0 \
4658c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN0)
4668c2ecf20Sopenharmony_ci#define QLA82XX_CRB_SQM_NET_1 \
4678c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN1)
4688c2ecf20Sopenharmony_ci#define QLA82XX_CRB_SQM_NET_2 \
4698c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN2)
4708c2ecf20Sopenharmony_ci#define QLA82XX_CRB_SQM_NET_3 \
4718c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN3)
4728c2ecf20Sopenharmony_ci#define QLA82XX_CRB_SRE \
4738c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SRE)
4748c2ecf20Sopenharmony_ci#define QLA82XX_CRB_TIMER \
4758c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_TIMR)
4768c2ecf20Sopenharmony_ci#define QLA82XX_CRB_XDMA \
4778c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_XDMA)
4788c2ecf20Sopenharmony_ci#define QLA82XX_CRB_I2C0 \
4798c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2C0)
4808c2ecf20Sopenharmony_ci#define QLA82XX_CRB_I2C1 \
4818c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2C1)
4828c2ecf20Sopenharmony_ci#define QLA82XX_CRB_OCM0 \
4838c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_OCM0)
4848c2ecf20Sopenharmony_ci#define QLA82XX_CRB_SMB \
4858c2ecf20Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SMB)
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_ci#define QLA82XX_CRB_MAX		QLA82XX_PCI_CRB_WINDOW(64)
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci/*
4908c2ecf20Sopenharmony_ci * ====================== BASE ADDRESSES ON-CHIP ======================
4918c2ecf20Sopenharmony_ci * Base addresses of major components on-chip.
4928c2ecf20Sopenharmony_ci * ====================== BASE ADDRESSES ON-CHIP ======================
4938c2ecf20Sopenharmony_ci */
4948c2ecf20Sopenharmony_ci#define QLA8XXX_ADDR_DDR_NET		(0x0000000000000000ULL)
4958c2ecf20Sopenharmony_ci#define QLA8XXX_ADDR_DDR_NET_MAX	(0x000000000fffffffULL)
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci/* Imbus address bit used to indicate a host address. This bit is
4988c2ecf20Sopenharmony_ci * eliminated by the pcie bar and bar select before presentation
4998c2ecf20Sopenharmony_ci * over pcie. */
5008c2ecf20Sopenharmony_ci/* host memory via IMBUS */
5018c2ecf20Sopenharmony_ci#define QLA82XX_P2_ADDR_PCIE	(0x0000000800000000ULL)
5028c2ecf20Sopenharmony_ci#define QLA82XX_P3_ADDR_PCIE	(0x0000008000000000ULL)
5038c2ecf20Sopenharmony_ci#define QLA82XX_ADDR_PCIE_MAX	(0x0000000FFFFFFFFFULL)
5048c2ecf20Sopenharmony_ci#define QLA8XXX_ADDR_OCM0	(0x0000000200000000ULL)
5058c2ecf20Sopenharmony_ci#define QLA8XXX_ADDR_OCM0_MAX	(0x00000002000fffffULL)
5068c2ecf20Sopenharmony_ci#define QLA8XXX_ADDR_OCM1	(0x0000000200400000ULL)
5078c2ecf20Sopenharmony_ci#define QLA8XXX_ADDR_OCM1_MAX	(0x00000002004fffffULL)
5088c2ecf20Sopenharmony_ci#define QLA8XXX_ADDR_QDR_NET	(0x0000000300000000ULL)
5098c2ecf20Sopenharmony_ci
5108c2ecf20Sopenharmony_ci#define QLA82XX_P2_ADDR_QDR_NET_MAX	(0x00000003001fffffULL)
5118c2ecf20Sopenharmony_ci#define QLA82XX_P3_ADDR_QDR_NET_MAX	(0x0000000303ffffffULL)
5128c2ecf20Sopenharmony_ci#define QLA8XXX_ADDR_QDR_NET_MAX	(0x0000000307ffffffULL)
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_ci#define QLA82XX_PCI_CRBSPACE		(unsigned long)0x06000000
5158c2ecf20Sopenharmony_ci#define QLA82XX_PCI_DIRECT_CRB		(unsigned long)0x04400000
5168c2ecf20Sopenharmony_ci#define QLA82XX_PCI_CAMQM		(unsigned long)0x04800000
5178c2ecf20Sopenharmony_ci#define QLA82XX_PCI_CAMQM_MAX		(unsigned long)0x04ffffff
5188c2ecf20Sopenharmony_ci#define QLA82XX_PCI_DDR_NET		(unsigned long)0x00000000
5198c2ecf20Sopenharmony_ci#define QLA82XX_PCI_QDR_NET		(unsigned long)0x04000000
5208c2ecf20Sopenharmony_ci#define QLA82XX_PCI_QDR_NET_MAX		(unsigned long)0x043fffff
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_ci/*  PCI Windowing for DDR regions.  */
5238c2ecf20Sopenharmony_ci#define QLA8XXX_ADDR_IN_RANGE(addr, low, high)            \
5248c2ecf20Sopenharmony_ci	(((addr) <= (high)) && ((addr) >= (low)))
5258c2ecf20Sopenharmony_ci
5268c2ecf20Sopenharmony_ci/*
5278c2ecf20Sopenharmony_ci *   Register offsets for MN
5288c2ecf20Sopenharmony_ci */
5298c2ecf20Sopenharmony_ci#define MIU_CONTROL			(0x000)
5308c2ecf20Sopenharmony_ci#define MIU_TAG				(0x004)
5318c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_CTRL		(0x090)
5328c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_ADDR_LO		(0x094)
5338c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_ADDR_HI		(0x098)
5348c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_WRDATA_LO		(0x0a0)
5358c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_WRDATA_HI		(0x0a4)
5368c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_WRDATA(i)		(0x0a0+(4*(i)))
5378c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_RDDATA_LO		(0x0a8)
5388c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_RDDATA_HI		(0x0ac)
5398c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_RDDATA(i)		(0x0a8+(4*(i)))
5408c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_ADDR_MASK		0xfffffff8
5418c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_UPPER_ADDR(off)	(0)
5428c2ecf20Sopenharmony_ci
5438c2ecf20Sopenharmony_ci/* MIU_TEST_AGT_CTRL flags. work for SIU as well */
5448c2ecf20Sopenharmony_ci#define MIU_TA_CTL_START	1
5458c2ecf20Sopenharmony_ci#define MIU_TA_CTL_ENABLE	2
5468c2ecf20Sopenharmony_ci#define MIU_TA_CTL_WRITE	4
5478c2ecf20Sopenharmony_ci#define MIU_TA_CTL_BUSY		8
5488c2ecf20Sopenharmony_ci
5498c2ecf20Sopenharmony_ci#define MIU_TA_CTL_WRITE_ENABLE		(MIU_TA_CTL_WRITE | MIU_TA_CTL_ENABLE)
5508c2ecf20Sopenharmony_ci#define MIU_TA_CTL_WRITE_START		(MIU_TA_CTL_WRITE | MIU_TA_CTL_ENABLE |\
5518c2ecf20Sopenharmony_ci					 MIU_TA_CTL_START)
5528c2ecf20Sopenharmony_ci#define MIU_TA_CTL_START_ENABLE		(MIU_TA_CTL_START | MIU_TA_CTL_ENABLE)
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci/*CAM RAM */
5558c2ecf20Sopenharmony_ci# define QLA82XX_CAM_RAM_BASE	(QLA82XX_CRB_CAM + 0x02000)
5568c2ecf20Sopenharmony_ci# define QLA82XX_CAM_RAM(reg)	(QLA82XX_CAM_RAM_BASE + (reg))
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci#define QLA82XX_PORT_MODE_ADDR		(QLA82XX_CAM_RAM(0x24))
5598c2ecf20Sopenharmony_ci#define QLA82XX_PEG_HALT_STATUS1	(QLA82XX_CAM_RAM(0xa8))
5608c2ecf20Sopenharmony_ci#define QLA82XX_PEG_HALT_STATUS2	(QLA82XX_CAM_RAM(0xac))
5618c2ecf20Sopenharmony_ci#define QLA82XX_PEG_ALIVE_COUNTER	(QLA82XX_CAM_RAM(0xb0))
5628c2ecf20Sopenharmony_ci#define QLA82XX_CAM_RAM_DB1		(QLA82XX_CAM_RAM(0x1b0))
5638c2ecf20Sopenharmony_ci#define QLA82XX_CAM_RAM_DB2		(QLA82XX_CAM_RAM(0x1b4))
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci#define HALT_STATUS_UNRECOVERABLE	0x80000000
5668c2ecf20Sopenharmony_ci#define HALT_STATUS_RECOVERABLE		0x40000000
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_ci#define QLA82XX_ROM_LOCK_ID		(QLA82XX_CAM_RAM(0x100))
5708c2ecf20Sopenharmony_ci#define QLA82XX_CRB_WIN_LOCK_ID		(QLA82XX_CAM_RAM(0x124))
5718c2ecf20Sopenharmony_ci#define QLA82XX_FW_VERSION_MAJOR	(QLA82XX_CAM_RAM(0x150))
5728c2ecf20Sopenharmony_ci#define QLA82XX_FW_VERSION_MINOR	(QLA82XX_CAM_RAM(0x154))
5738c2ecf20Sopenharmony_ci#define QLA82XX_FW_VERSION_SUB		(QLA82XX_CAM_RAM(0x158))
5748c2ecf20Sopenharmony_ci#define QLA82XX_PCIE_REG(reg)		(QLA82XX_CRB_PCIE + (reg))
5758c2ecf20Sopenharmony_ci
5768c2ecf20Sopenharmony_ci/* Driver Coexistence Defines */
5778c2ecf20Sopenharmony_ci#define QLA82XX_CRB_DRV_ACTIVE		(QLA82XX_CAM_RAM(0x138))
5788c2ecf20Sopenharmony_ci#define QLA82XX_CRB_DEV_STATE		(QLA82XX_CAM_RAM(0x140))
5798c2ecf20Sopenharmony_ci#define QLA82XX_CRB_DRV_STATE		(QLA82XX_CAM_RAM(0x144))
5808c2ecf20Sopenharmony_ci#define QLA82XX_CRB_DRV_SCRATCH		(QLA82XX_CAM_RAM(0x148))
5818c2ecf20Sopenharmony_ci#define QLA82XX_CRB_DEV_PART_INFO	(QLA82XX_CAM_RAM(0x14c))
5828c2ecf20Sopenharmony_ci#define QLA82XX_CRB_DRV_IDC_VERSION	(QLA82XX_CAM_RAM(0x174))
5838c2ecf20Sopenharmony_ci
5848c2ecf20Sopenharmony_cienum qla_regs {
5858c2ecf20Sopenharmony_ci	QLA8XXX_PEG_HALT_STATUS1 = 0,
5868c2ecf20Sopenharmony_ci	QLA8XXX_PEG_HALT_STATUS2,
5878c2ecf20Sopenharmony_ci	QLA8XXX_PEG_ALIVE_COUNTER,
5888c2ecf20Sopenharmony_ci	QLA8XXX_CRB_DRV_ACTIVE,
5898c2ecf20Sopenharmony_ci	QLA8XXX_CRB_DEV_STATE,
5908c2ecf20Sopenharmony_ci	QLA8XXX_CRB_DRV_STATE,
5918c2ecf20Sopenharmony_ci	QLA8XXX_CRB_DRV_SCRATCH,
5928c2ecf20Sopenharmony_ci	QLA8XXX_CRB_DEV_PART_INFO,
5938c2ecf20Sopenharmony_ci	QLA8XXX_CRB_DRV_IDC_VERSION,
5948c2ecf20Sopenharmony_ci	QLA8XXX_FW_VERSION_MAJOR,
5958c2ecf20Sopenharmony_ci	QLA8XXX_FW_VERSION_MINOR,
5968c2ecf20Sopenharmony_ci	QLA8XXX_FW_VERSION_SUB,
5978c2ecf20Sopenharmony_ci	QLA8XXX_CRB_CMDPEG_STATE,
5988c2ecf20Sopenharmony_ci	QLA8XXX_CRB_TEMP_STATE,
5998c2ecf20Sopenharmony_ci};
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_ci/* Every driver should use these Device State */
6028c2ecf20Sopenharmony_ci#define QLA8XXX_DEV_COLD		1
6038c2ecf20Sopenharmony_ci#define QLA8XXX_DEV_INITIALIZING	2
6048c2ecf20Sopenharmony_ci#define QLA8XXX_DEV_READY		3
6058c2ecf20Sopenharmony_ci#define QLA8XXX_DEV_NEED_RESET		4
6068c2ecf20Sopenharmony_ci#define QLA8XXX_DEV_NEED_QUIESCENT	5
6078c2ecf20Sopenharmony_ci#define QLA8XXX_DEV_FAILED		6
6088c2ecf20Sopenharmony_ci#define QLA8XXX_DEV_QUIESCENT		7
6098c2ecf20Sopenharmony_ci#define MAX_STATES			8 /* Increment if new state added */
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci#define QLA82XX_IDC_VERSION		0x1
6128c2ecf20Sopenharmony_ci#define ROM_DEV_INIT_TIMEOUT		30
6138c2ecf20Sopenharmony_ci#define ROM_DRV_RESET_ACK_TIMEOUT	10
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci#define PCIE_SETUP_FUNCTION		(0x12040)
6168c2ecf20Sopenharmony_ci#define PCIE_SETUP_FUNCTION2		(0x12048)
6178c2ecf20Sopenharmony_ci
6188c2ecf20Sopenharmony_ci#define QLA82XX_PCIX_PS_REG(reg)	(QLA82XX_CRB_PCIX_MD + (reg))
6198c2ecf20Sopenharmony_ci#define QLA82XX_PCIX_PS2_REG(reg)	(QLA82XX_CRB_PCIE2 + (reg))
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci#define PCIE_SEM2_LOCK		(0x1c010)  /* Flash lock   */
6228c2ecf20Sopenharmony_ci#define PCIE_SEM2_UNLOCK	(0x1c014)  /* Flash unlock */
6238c2ecf20Sopenharmony_ci#define PCIE_SEM5_LOCK		(0x1c028)  /* Coexistence lock   */
6248c2ecf20Sopenharmony_ci#define PCIE_SEM5_UNLOCK	(0x1c02c)  /* Coexistence unlock */
6258c2ecf20Sopenharmony_ci#define PCIE_SEM7_LOCK		(0x1c038)  /* crb win lock */
6268c2ecf20Sopenharmony_ci#define PCIE_SEM7_UNLOCK	(0x1c03c)  /* crbwin unlock*/
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_ci/*
6298c2ecf20Sopenharmony_ci * The PCI VendorID and DeviceID for our board.
6308c2ecf20Sopenharmony_ci */
6318c2ecf20Sopenharmony_ci#define QLA82XX_MSIX_TBL_SPACE		8192
6328c2ecf20Sopenharmony_ci#define QLA82XX_PCI_REG_MSIX_TBL	0x44
6338c2ecf20Sopenharmony_ci#define QLA82XX_PCI_MSIX_CONTROL	0x40
6348c2ecf20Sopenharmony_ci
6358c2ecf20Sopenharmony_cistruct crb_128M_2M_sub_block_map {
6368c2ecf20Sopenharmony_ci	unsigned valid;
6378c2ecf20Sopenharmony_ci	unsigned start_128M;
6388c2ecf20Sopenharmony_ci	unsigned end_128M;
6398c2ecf20Sopenharmony_ci	unsigned start_2M;
6408c2ecf20Sopenharmony_ci};
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_cistruct crb_128M_2M_block_map {
6438c2ecf20Sopenharmony_ci	struct crb_128M_2M_sub_block_map sub_block[16];
6448c2ecf20Sopenharmony_ci};
6458c2ecf20Sopenharmony_ci
6468c2ecf20Sopenharmony_cistruct crb_addr_pair {
6478c2ecf20Sopenharmony_ci	long addr;
6488c2ecf20Sopenharmony_ci	long data;
6498c2ecf20Sopenharmony_ci};
6508c2ecf20Sopenharmony_ci
6518c2ecf20Sopenharmony_ci#define ADDR_ERROR	((unsigned long) 0xffffffff)
6528c2ecf20Sopenharmony_ci#define MAX_CTL_CHECK	1000
6538c2ecf20Sopenharmony_ci#define QLA82XX_FWERROR_CODE(code)	((code >> 8) & 0x1fffff)
6548c2ecf20Sopenharmony_ci
6558c2ecf20Sopenharmony_ci/***************************************************************************
6568c2ecf20Sopenharmony_ci *		PCI related defines.
6578c2ecf20Sopenharmony_ci **************************************************************************/
6588c2ecf20Sopenharmony_ci
6598c2ecf20Sopenharmony_ci/*
6608c2ecf20Sopenharmony_ci * Interrupt related defines.
6618c2ecf20Sopenharmony_ci */
6628c2ecf20Sopenharmony_ci#define PCIX_TARGET_STATUS	(0x10118)
6638c2ecf20Sopenharmony_ci#define PCIX_TARGET_STATUS_F1	(0x10160)
6648c2ecf20Sopenharmony_ci#define PCIX_TARGET_STATUS_F2	(0x10164)
6658c2ecf20Sopenharmony_ci#define PCIX_TARGET_STATUS_F3	(0x10168)
6668c2ecf20Sopenharmony_ci#define PCIX_TARGET_STATUS_F4	(0x10360)
6678c2ecf20Sopenharmony_ci#define PCIX_TARGET_STATUS_F5	(0x10364)
6688c2ecf20Sopenharmony_ci#define PCIX_TARGET_STATUS_F6	(0x10368)
6698c2ecf20Sopenharmony_ci#define PCIX_TARGET_STATUS_F7	(0x1036c)
6708c2ecf20Sopenharmony_ci
6718c2ecf20Sopenharmony_ci#define PCIX_TARGET_MASK	(0x10128)
6728c2ecf20Sopenharmony_ci#define PCIX_TARGET_MASK_F1	(0x10170)
6738c2ecf20Sopenharmony_ci#define PCIX_TARGET_MASK_F2	(0x10174)
6748c2ecf20Sopenharmony_ci#define PCIX_TARGET_MASK_F3	(0x10178)
6758c2ecf20Sopenharmony_ci#define PCIX_TARGET_MASK_F4	(0x10370)
6768c2ecf20Sopenharmony_ci#define PCIX_TARGET_MASK_F5	(0x10374)
6778c2ecf20Sopenharmony_ci#define PCIX_TARGET_MASK_F6	(0x10378)
6788c2ecf20Sopenharmony_ci#define PCIX_TARGET_MASK_F7	(0x1037c)
6798c2ecf20Sopenharmony_ci
6808c2ecf20Sopenharmony_ci/*
6818c2ecf20Sopenharmony_ci * Message Signaled Interrupts
6828c2ecf20Sopenharmony_ci */
6838c2ecf20Sopenharmony_ci#define PCIX_MSI_F0		(0x13000)
6848c2ecf20Sopenharmony_ci#define PCIX_MSI_F1		(0x13004)
6858c2ecf20Sopenharmony_ci#define PCIX_MSI_F2		(0x13008)
6868c2ecf20Sopenharmony_ci#define PCIX_MSI_F3		(0x1300c)
6878c2ecf20Sopenharmony_ci#define PCIX_MSI_F4		(0x13010)
6888c2ecf20Sopenharmony_ci#define PCIX_MSI_F5		(0x13014)
6898c2ecf20Sopenharmony_ci#define PCIX_MSI_F6		(0x13018)
6908c2ecf20Sopenharmony_ci#define PCIX_MSI_F7		(0x1301c)
6918c2ecf20Sopenharmony_ci#define PCIX_MSI_F(FUNC)	(0x13000 + ((FUNC) * 4))
6928c2ecf20Sopenharmony_ci
6938c2ecf20Sopenharmony_ci/*
6948c2ecf20Sopenharmony_ci *
6958c2ecf20Sopenharmony_ci */
6968c2ecf20Sopenharmony_ci#define PCIX_INT_VECTOR		(0x10100)
6978c2ecf20Sopenharmony_ci#define PCIX_INT_MASK		(0x10104)
6988c2ecf20Sopenharmony_ci
6998c2ecf20Sopenharmony_ci/*
7008c2ecf20Sopenharmony_ci * Interrupt state machine and other bits.
7018c2ecf20Sopenharmony_ci */
7028c2ecf20Sopenharmony_ci#define PCIE_MISCCFG_RC		(0x1206c)
7038c2ecf20Sopenharmony_ci
7048c2ecf20Sopenharmony_ci
7058c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_STATUS \
7068c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS))
7078c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F1 \
7088c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F1))
7098c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F2 \
7108c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F2))
7118c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F3 \
7128c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F3))
7138c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F4 \
7148c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F4))
7158c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F5 \
7168c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F5))
7178c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F6 \
7188c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F6))
7198c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F7 \
7208c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F7))
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_MASK \
7238c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK))
7248c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_MASK_F1 \
7258c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F1))
7268c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_MASK_F2 \
7278c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F2))
7288c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_MASK_F3 \
7298c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F3))
7308c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_MASK_F4 \
7318c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F4))
7328c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_MASK_F5 \
7338c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F5))
7348c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_MASK_F6 \
7358c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F6))
7368c2ecf20Sopenharmony_ci#define ISR_INT_TARGET_MASK_F7 \
7378c2ecf20Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F7))
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_ci#define ISR_INT_VECTOR			(QLA82XX_PCIX_PS_REG(PCIX_INT_VECTOR))
7408c2ecf20Sopenharmony_ci#define ISR_INT_MASK			(QLA82XX_PCIX_PS_REG(PCIX_INT_MASK))
7418c2ecf20Sopenharmony_ci#define ISR_INT_STATE_REG		(QLA82XX_PCIX_PS_REG(PCIE_MISCCFG_RC))
7428c2ecf20Sopenharmony_ci
7438c2ecf20Sopenharmony_ci#define	ISR_MSI_INT_TRIGGER(FUNC)	(QLA82XX_PCIX_PS_REG(PCIX_MSI_F(FUNC)))
7448c2ecf20Sopenharmony_ci
7458c2ecf20Sopenharmony_ci
7468c2ecf20Sopenharmony_ci#define	ISR_IS_LEGACY_INTR_IDLE(VAL)		(((VAL) & 0x300) == 0)
7478c2ecf20Sopenharmony_ci#define	ISR_IS_LEGACY_INTR_TRIGGERED(VAL)	(((VAL) & 0x300) == 0x200)
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci/*
7508c2ecf20Sopenharmony_ci * PCI Interrupt Vector Values.
7518c2ecf20Sopenharmony_ci */
7528c2ecf20Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F0	0x0080
7538c2ecf20Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F1	0x0100
7548c2ecf20Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F2	0x0200
7558c2ecf20Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F3	0x0400
7568c2ecf20Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F4	0x0800
7578c2ecf20Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F5	0x1000
7588c2ecf20Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F6	0x2000
7598c2ecf20Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F7	0x4000
7608c2ecf20Sopenharmony_ci
7618c2ecf20Sopenharmony_ci/* struct qla4_8xxx_legacy_intr_set defined in ql4_def.h */
7628c2ecf20Sopenharmony_ci
7638c2ecf20Sopenharmony_ci#define QLA82XX_LEGACY_INTR_CONFIG                                      \
7648c2ecf20Sopenharmony_ci{                                                                       \
7658c2ecf20Sopenharmony_ci	{                                                               \
7668c2ecf20Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F0,         \
7678c2ecf20Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS,          \
7688c2ecf20Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK,            \
7698c2ecf20Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(0) },       \
7708c2ecf20Sopenharmony_ci									\
7718c2ecf20Sopenharmony_ci	{								\
7728c2ecf20Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F1,         \
7738c2ecf20Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F1,       \
7748c2ecf20Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F1,         \
7758c2ecf20Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(1) },       \
7768c2ecf20Sopenharmony_ci									\
7778c2ecf20Sopenharmony_ci	{								\
7788c2ecf20Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F2,         \
7798c2ecf20Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F2,       \
7808c2ecf20Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F2,         \
7818c2ecf20Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(2) },       \
7828c2ecf20Sopenharmony_ci									\
7838c2ecf20Sopenharmony_ci	{								\
7848c2ecf20Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F3,         \
7858c2ecf20Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F3,       \
7868c2ecf20Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F3,         \
7878c2ecf20Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(3) },       \
7888c2ecf20Sopenharmony_ci									\
7898c2ecf20Sopenharmony_ci	{								\
7908c2ecf20Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F4,         \
7918c2ecf20Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F4,       \
7928c2ecf20Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F4,         \
7938c2ecf20Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(4) },       \
7948c2ecf20Sopenharmony_ci									\
7958c2ecf20Sopenharmony_ci	{								\
7968c2ecf20Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F5,         \
7978c2ecf20Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F5,       \
7988c2ecf20Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F5,         \
7998c2ecf20Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(5) },       \
8008c2ecf20Sopenharmony_ci									\
8018c2ecf20Sopenharmony_ci	{								\
8028c2ecf20Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F6,         \
8038c2ecf20Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F6,       \
8048c2ecf20Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F6,         \
8058c2ecf20Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(6) },       \
8068c2ecf20Sopenharmony_ci									\
8078c2ecf20Sopenharmony_ci	{								\
8088c2ecf20Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F7,         \
8098c2ecf20Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F7,       \
8108c2ecf20Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F7,         \
8118c2ecf20Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(7) },       \
8128c2ecf20Sopenharmony_ci}
8138c2ecf20Sopenharmony_ci
8148c2ecf20Sopenharmony_ci/* Magic number to let user know flash is programmed */
8158c2ecf20Sopenharmony_ci#define	QLA82XX_BDINFO_MAGIC	0x12345678
8168c2ecf20Sopenharmony_ci#define FW_SIZE_OFFSET		(0x3e840c)
8178c2ecf20Sopenharmony_ci
8188c2ecf20Sopenharmony_ci/* QLA82XX additions */
8198c2ecf20Sopenharmony_ci#define MIU_TEST_AGT_WRDATA_UPPER_LO	(0x0b0)
8208c2ecf20Sopenharmony_ci#define	MIU_TEST_AGT_WRDATA_UPPER_HI	(0x0b4)
8218c2ecf20Sopenharmony_ci
8228c2ecf20Sopenharmony_ci/* Minidump related */
8238c2ecf20Sopenharmony_ci
8248c2ecf20Sopenharmony_ci/* Entry Type Defines */
8258c2ecf20Sopenharmony_ci#define QLA8XXX_RDNOP	0
8268c2ecf20Sopenharmony_ci#define QLA8XXX_RDCRB	1
8278c2ecf20Sopenharmony_ci#define QLA8XXX_RDMUX	2
8288c2ecf20Sopenharmony_ci#define QLA8XXX_QUEUE	3
8298c2ecf20Sopenharmony_ci#define QLA8XXX_BOARD	4
8308c2ecf20Sopenharmony_ci#define QLA8XXX_RDOCM	6
8318c2ecf20Sopenharmony_ci#define QLA8XXX_PREGS	7
8328c2ecf20Sopenharmony_ci#define QLA8XXX_L1DTG	8
8338c2ecf20Sopenharmony_ci#define QLA8XXX_L1ITG	9
8348c2ecf20Sopenharmony_ci#define QLA8XXX_L1DAT	11
8358c2ecf20Sopenharmony_ci#define QLA8XXX_L1INS	12
8368c2ecf20Sopenharmony_ci#define QLA8XXX_L2DTG	21
8378c2ecf20Sopenharmony_ci#define QLA8XXX_L2ITG	22
8388c2ecf20Sopenharmony_ci#define QLA8XXX_L2DAT	23
8398c2ecf20Sopenharmony_ci#define QLA8XXX_L2INS	24
8408c2ecf20Sopenharmony_ci#define QLA83XX_POLLRD	35
8418c2ecf20Sopenharmony_ci#define QLA83XX_RDMUX2	36
8428c2ecf20Sopenharmony_ci#define QLA83XX_POLLRDMWR  37
8438c2ecf20Sopenharmony_ci#define QLA8044_RDDFE	38
8448c2ecf20Sopenharmony_ci#define QLA8044_RDMDIO	39
8458c2ecf20Sopenharmony_ci#define QLA8044_POLLWR	40
8468c2ecf20Sopenharmony_ci#define QLA8XXX_RDROM	71
8478c2ecf20Sopenharmony_ci#define QLA8XXX_RDMEM	72
8488c2ecf20Sopenharmony_ci#define QLA8XXX_CNTRL	98
8498c2ecf20Sopenharmony_ci#define QLA83XX_TLHDR	99
8508c2ecf20Sopenharmony_ci#define QLA8XXX_RDEND	255
8518c2ecf20Sopenharmony_ci
8528c2ecf20Sopenharmony_ci/* Opcodes for Control Entries.
8538c2ecf20Sopenharmony_ci * These Flags are bit fields.
8548c2ecf20Sopenharmony_ci */
8558c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_WR		0x01
8568c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_RW		0x02
8578c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_AND		0x04
8588c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_OR		0x08
8598c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_POLL		0x10
8608c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_RDSTATE	0x20
8618c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_WRSTATE	0x40
8628c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_MDSTATE	0x80
8638c2ecf20Sopenharmony_ci
8648c2ecf20Sopenharmony_ci/* Driver Flags */
8658c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_SKIPPED_FLAG	0x80 /* driver skipped this entry  */
8668c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_SIZE_ERR_FLAG	0x40 /* Entry vs Capture size
8678c2ecf20Sopenharmony_ci					      * mismatch */
8688c2ecf20Sopenharmony_ci
8698c2ecf20Sopenharmony_ci/* Driver_code is for driver to write some info about the entry
8708c2ecf20Sopenharmony_ci * currently not used.
8718c2ecf20Sopenharmony_ci */
8728c2ecf20Sopenharmony_cistruct qla8xxx_minidump_entry_hdr {
8738c2ecf20Sopenharmony_ci	uint32_t entry_type;
8748c2ecf20Sopenharmony_ci	uint32_t entry_size;
8758c2ecf20Sopenharmony_ci	uint32_t entry_capture_size;
8768c2ecf20Sopenharmony_ci	struct {
8778c2ecf20Sopenharmony_ci		uint8_t entry_capture_mask;
8788c2ecf20Sopenharmony_ci		uint8_t entry_code;
8798c2ecf20Sopenharmony_ci		uint8_t driver_code;
8808c2ecf20Sopenharmony_ci		uint8_t driver_flags;
8818c2ecf20Sopenharmony_ci	} d_ctrl;
8828c2ecf20Sopenharmony_ci};
8838c2ecf20Sopenharmony_ci
8848c2ecf20Sopenharmony_ci/*  Read CRB entry header */
8858c2ecf20Sopenharmony_cistruct qla8xxx_minidump_entry_crb {
8868c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
8878c2ecf20Sopenharmony_ci	uint32_t addr;
8888c2ecf20Sopenharmony_ci	struct {
8898c2ecf20Sopenharmony_ci		uint8_t addr_stride;
8908c2ecf20Sopenharmony_ci		uint8_t state_index_a;
8918c2ecf20Sopenharmony_ci		uint16_t poll_timeout;
8928c2ecf20Sopenharmony_ci	} crb_strd;
8938c2ecf20Sopenharmony_ci	uint32_t data_size;
8948c2ecf20Sopenharmony_ci	uint32_t op_count;
8958c2ecf20Sopenharmony_ci
8968c2ecf20Sopenharmony_ci	struct {
8978c2ecf20Sopenharmony_ci		uint8_t opcode;
8988c2ecf20Sopenharmony_ci		uint8_t state_index_v;
8998c2ecf20Sopenharmony_ci		uint8_t shl;
9008c2ecf20Sopenharmony_ci		uint8_t shr;
9018c2ecf20Sopenharmony_ci	} crb_ctrl;
9028c2ecf20Sopenharmony_ci
9038c2ecf20Sopenharmony_ci	uint32_t value_1;
9048c2ecf20Sopenharmony_ci	uint32_t value_2;
9058c2ecf20Sopenharmony_ci	uint32_t value_3;
9068c2ecf20Sopenharmony_ci};
9078c2ecf20Sopenharmony_ci
9088c2ecf20Sopenharmony_cistruct qla8xxx_minidump_entry_cache {
9098c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
9108c2ecf20Sopenharmony_ci	uint32_t tag_reg_addr;
9118c2ecf20Sopenharmony_ci	struct {
9128c2ecf20Sopenharmony_ci		uint16_t tag_value_stride;
9138c2ecf20Sopenharmony_ci		uint16_t init_tag_value;
9148c2ecf20Sopenharmony_ci	} addr_ctrl;
9158c2ecf20Sopenharmony_ci	uint32_t data_size;
9168c2ecf20Sopenharmony_ci	uint32_t op_count;
9178c2ecf20Sopenharmony_ci	uint32_t control_addr;
9188c2ecf20Sopenharmony_ci	struct {
9198c2ecf20Sopenharmony_ci		uint16_t write_value;
9208c2ecf20Sopenharmony_ci		uint8_t poll_mask;
9218c2ecf20Sopenharmony_ci		uint8_t poll_wait;
9228c2ecf20Sopenharmony_ci	} cache_ctrl;
9238c2ecf20Sopenharmony_ci	uint32_t read_addr;
9248c2ecf20Sopenharmony_ci	struct {
9258c2ecf20Sopenharmony_ci		uint8_t read_addr_stride;
9268c2ecf20Sopenharmony_ci		uint8_t read_addr_cnt;
9278c2ecf20Sopenharmony_ci		uint16_t rsvd_1;
9288c2ecf20Sopenharmony_ci	} read_ctrl;
9298c2ecf20Sopenharmony_ci};
9308c2ecf20Sopenharmony_ci
9318c2ecf20Sopenharmony_ci/* Read OCM */
9328c2ecf20Sopenharmony_cistruct qla8xxx_minidump_entry_rdocm {
9338c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
9348c2ecf20Sopenharmony_ci	uint32_t rsvd_0;
9358c2ecf20Sopenharmony_ci	uint32_t rsvd_1;
9368c2ecf20Sopenharmony_ci	uint32_t data_size;
9378c2ecf20Sopenharmony_ci	uint32_t op_count;
9388c2ecf20Sopenharmony_ci	uint32_t rsvd_2;
9398c2ecf20Sopenharmony_ci	uint32_t rsvd_3;
9408c2ecf20Sopenharmony_ci	uint32_t read_addr;
9418c2ecf20Sopenharmony_ci	uint32_t read_addr_stride;
9428c2ecf20Sopenharmony_ci};
9438c2ecf20Sopenharmony_ci
9448c2ecf20Sopenharmony_ci/* Read Memory */
9458c2ecf20Sopenharmony_cistruct qla8xxx_minidump_entry_rdmem {
9468c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
9478c2ecf20Sopenharmony_ci	uint32_t rsvd[6];
9488c2ecf20Sopenharmony_ci	uint32_t read_addr;
9498c2ecf20Sopenharmony_ci	uint32_t read_data_size;
9508c2ecf20Sopenharmony_ci};
9518c2ecf20Sopenharmony_ci
9528c2ecf20Sopenharmony_ci/* Read ROM */
9538c2ecf20Sopenharmony_cistruct qla8xxx_minidump_entry_rdrom {
9548c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
9558c2ecf20Sopenharmony_ci	uint32_t rsvd[6];
9568c2ecf20Sopenharmony_ci	uint32_t read_addr;
9578c2ecf20Sopenharmony_ci	uint32_t read_data_size;
9588c2ecf20Sopenharmony_ci};
9598c2ecf20Sopenharmony_ci
9608c2ecf20Sopenharmony_ci/* Mux entry */
9618c2ecf20Sopenharmony_cistruct qla8xxx_minidump_entry_mux {
9628c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
9638c2ecf20Sopenharmony_ci	uint32_t select_addr;
9648c2ecf20Sopenharmony_ci	uint32_t rsvd_0;
9658c2ecf20Sopenharmony_ci	uint32_t data_size;
9668c2ecf20Sopenharmony_ci	uint32_t op_count;
9678c2ecf20Sopenharmony_ci	uint32_t select_value;
9688c2ecf20Sopenharmony_ci	uint32_t select_value_stride;
9698c2ecf20Sopenharmony_ci	uint32_t read_addr;
9708c2ecf20Sopenharmony_ci	uint32_t rsvd_1;
9718c2ecf20Sopenharmony_ci};
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_ci/* Queue entry */
9748c2ecf20Sopenharmony_cistruct qla8xxx_minidump_entry_queue {
9758c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
9768c2ecf20Sopenharmony_ci	uint32_t select_addr;
9778c2ecf20Sopenharmony_ci	struct {
9788c2ecf20Sopenharmony_ci		uint16_t queue_id_stride;
9798c2ecf20Sopenharmony_ci		uint16_t rsvd_0;
9808c2ecf20Sopenharmony_ci	} q_strd;
9818c2ecf20Sopenharmony_ci	uint32_t data_size;
9828c2ecf20Sopenharmony_ci	uint32_t op_count;
9838c2ecf20Sopenharmony_ci	uint32_t rsvd_1;
9848c2ecf20Sopenharmony_ci	uint32_t rsvd_2;
9858c2ecf20Sopenharmony_ci	uint32_t read_addr;
9868c2ecf20Sopenharmony_ci	struct {
9878c2ecf20Sopenharmony_ci		uint8_t read_addr_stride;
9888c2ecf20Sopenharmony_ci		uint8_t read_addr_cnt;
9898c2ecf20Sopenharmony_ci		uint16_t rsvd_3;
9908c2ecf20Sopenharmony_ci	} rd_strd;
9918c2ecf20Sopenharmony_ci};
9928c2ecf20Sopenharmony_ci
9938c2ecf20Sopenharmony_ci#define MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE	0x129
9948c2ecf20Sopenharmony_ci#define RQST_TMPLT_SIZE				0x0
9958c2ecf20Sopenharmony_ci#define RQST_TMPLT				0x1
9968c2ecf20Sopenharmony_ci#define MD_DIRECT_ROM_WINDOW			0x42110030
9978c2ecf20Sopenharmony_ci#define MD_DIRECT_ROM_READ_BASE			0x42150000
9988c2ecf20Sopenharmony_ci#define MD_MIU_TEST_AGT_CTRL			0x41000090
9998c2ecf20Sopenharmony_ci#define MD_MIU_TEST_AGT_ADDR_LO			0x41000094
10008c2ecf20Sopenharmony_ci#define MD_MIU_TEST_AGT_ADDR_HI			0x41000098
10018c2ecf20Sopenharmony_ci
10028c2ecf20Sopenharmony_ci#define MD_MIU_TEST_AGT_WRDATA_LO		0x410000A0
10038c2ecf20Sopenharmony_ci#define MD_MIU_TEST_AGT_WRDATA_HI		0x410000A4
10048c2ecf20Sopenharmony_ci#define MD_MIU_TEST_AGT_WRDATA_ULO		0x410000B0
10058c2ecf20Sopenharmony_ci#define MD_MIU_TEST_AGT_WRDATA_UHI		0x410000B4
10068c2ecf20Sopenharmony_ci
10078c2ecf20Sopenharmony_ci#endif
1008