162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * QLogic iSCSI HBA Driver
462306a36Sopenharmony_ci * Copyright (c)  2003-2013 QLogic Corporation
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci#ifndef __QLA_NX_H
762306a36Sopenharmony_ci#define __QLA_NX_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/*
1062306a36Sopenharmony_ci * Following are the states of the Phantom. Phantom will set them and
1162306a36Sopenharmony_ci * Host will read to check if the fields are correct.
1262306a36Sopenharmony_ci*/
1362306a36Sopenharmony_ci#define PHAN_INITIALIZE_FAILED		0xffff
1462306a36Sopenharmony_ci#define PHAN_INITIALIZE_COMPLETE	0xff01
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* Host writes the following to notify that it has done the init-handshake */
1762306a36Sopenharmony_ci#define PHAN_INITIALIZE_ACK		0xf00f
1862306a36Sopenharmony_ci#define PHAN_PEG_RCV_INITIALIZED	0xff01
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci/*CRB_RELATED*/
2162306a36Sopenharmony_ci#define QLA82XX_CRB_BASE		(QLA82XX_CAM_RAM(0x200))
2262306a36Sopenharmony_ci#define QLA82XX_REG(X)			(QLA82XX_CRB_BASE+(X))
2362306a36Sopenharmony_ci#define CRB_CMDPEG_STATE		QLA82XX_REG(0x50)
2462306a36Sopenharmony_ci#define CRB_RCVPEG_STATE		QLA82XX_REG(0x13c)
2562306a36Sopenharmony_ci#define CRB_DMA_SHIFT			QLA82XX_REG(0xcc)
2662306a36Sopenharmony_ci#define CRB_TEMP_STATE			QLA82XX_REG(0x1b4)
2762306a36Sopenharmony_ci#define CRB_CMDPEG_CHECK_RETRY_COUNT	60
2862306a36Sopenharmony_ci#define CRB_CMDPEG_CHECK_DELAY		500
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define qla82xx_get_temp_val(x)		((x) >> 16)
3162306a36Sopenharmony_ci#define qla82xx_get_temp_state(x)	((x) & 0xffff)
3262306a36Sopenharmony_ci#define qla82xx_encode_temp(val, state)	(((val) << 16) | (state))
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/*
3562306a36Sopenharmony_ci * Temperature control.
3662306a36Sopenharmony_ci */
3762306a36Sopenharmony_cienum {
3862306a36Sopenharmony_ci	QLA82XX_TEMP_NORMAL = 0x1,	/* Normal operating range */
3962306a36Sopenharmony_ci	QLA82XX_TEMP_WARN,	/* Sound alert, temperature getting high */
4062306a36Sopenharmony_ci	QLA82XX_TEMP_PANIC	/* Fatal error, hardware has shut down. */
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define CRB_NIU_XG_PAUSE_CTL_P0		0x1
4462306a36Sopenharmony_ci#define CRB_NIU_XG_PAUSE_CTL_P1		0x8
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#define QLA82XX_HW_H0_CH_HUB_ADR	0x05
4762306a36Sopenharmony_ci#define QLA82XX_HW_H1_CH_HUB_ADR	0x0E
4862306a36Sopenharmony_ci#define QLA82XX_HW_H2_CH_HUB_ADR	0x03
4962306a36Sopenharmony_ci#define QLA82XX_HW_H3_CH_HUB_ADR	0x01
5062306a36Sopenharmony_ci#define QLA82XX_HW_H4_CH_HUB_ADR	0x06
5162306a36Sopenharmony_ci#define QLA82XX_HW_H5_CH_HUB_ADR	0x07
5262306a36Sopenharmony_ci#define QLA82XX_HW_H6_CH_HUB_ADR	0x08
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/*  Hub 0 */
5562306a36Sopenharmony_ci#define QLA82XX_HW_MN_CRB_AGT_ADR	0x15
5662306a36Sopenharmony_ci#define QLA82XX_HW_MS_CRB_AGT_ADR	0x25
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci/*  Hub 1 */
5962306a36Sopenharmony_ci#define QLA82XX_HW_PS_CRB_AGT_ADR	0x73
6062306a36Sopenharmony_ci#define QLA82XX_HW_QMS_CRB_AGT_ADR	0x00
6162306a36Sopenharmony_ci#define QLA82XX_HW_RPMX3_CRB_AGT_ADR	0x0b
6262306a36Sopenharmony_ci#define QLA82XX_HW_SQGS0_CRB_AGT_ADR	0x01
6362306a36Sopenharmony_ci#define QLA82XX_HW_SQGS1_CRB_AGT_ADR	0x02
6462306a36Sopenharmony_ci#define QLA82XX_HW_SQGS2_CRB_AGT_ADR	0x03
6562306a36Sopenharmony_ci#define QLA82XX_HW_SQGS3_CRB_AGT_ADR	0x04
6662306a36Sopenharmony_ci#define QLA82XX_HW_C2C0_CRB_AGT_ADR	0x58
6762306a36Sopenharmony_ci#define QLA82XX_HW_C2C1_CRB_AGT_ADR	0x59
6862306a36Sopenharmony_ci#define QLA82XX_HW_C2C2_CRB_AGT_ADR	0x5a
6962306a36Sopenharmony_ci#define QLA82XX_HW_RPMX2_CRB_AGT_ADR	0x0a
7062306a36Sopenharmony_ci#define QLA82XX_HW_RPMX4_CRB_AGT_ADR	0x0c
7162306a36Sopenharmony_ci#define QLA82XX_HW_RPMX7_CRB_AGT_ADR	0x0f
7262306a36Sopenharmony_ci#define QLA82XX_HW_RPMX9_CRB_AGT_ADR	0x12
7362306a36Sopenharmony_ci#define QLA82XX_HW_SMB_CRB_AGT_ADR	0x18
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci/*  Hub 2 */
7662306a36Sopenharmony_ci#define QLA82XX_HW_NIU_CRB_AGT_ADR	0x31
7762306a36Sopenharmony_ci#define QLA82XX_HW_I2C0_CRB_AGT_ADR	0x19
7862306a36Sopenharmony_ci#define QLA82XX_HW_I2C1_CRB_AGT_ADR	0x29
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci#define QLA82XX_HW_SN_CRB_AGT_ADR	0x10
8162306a36Sopenharmony_ci#define QLA82XX_HW_I2Q_CRB_AGT_ADR	0x20
8262306a36Sopenharmony_ci#define QLA82XX_HW_LPC_CRB_AGT_ADR	0x22
8362306a36Sopenharmony_ci#define QLA82XX_HW_ROMUSB_CRB_AGT_ADR   0x21
8462306a36Sopenharmony_ci#define QLA82XX_HW_QM_CRB_AGT_ADR	0x66
8562306a36Sopenharmony_ci#define QLA82XX_HW_SQG0_CRB_AGT_ADR	0x60
8662306a36Sopenharmony_ci#define QLA82XX_HW_SQG1_CRB_AGT_ADR	0x61
8762306a36Sopenharmony_ci#define QLA82XX_HW_SQG2_CRB_AGT_ADR	0x62
8862306a36Sopenharmony_ci#define QLA82XX_HW_SQG3_CRB_AGT_ADR	0x63
8962306a36Sopenharmony_ci#define QLA82XX_HW_RPMX1_CRB_AGT_ADR    0x09
9062306a36Sopenharmony_ci#define QLA82XX_HW_RPMX5_CRB_AGT_ADR    0x0d
9162306a36Sopenharmony_ci#define QLA82XX_HW_RPMX6_CRB_AGT_ADR    0x0e
9262306a36Sopenharmony_ci#define QLA82XX_HW_RPMX8_CRB_AGT_ADR    0x11
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci/*  Hub 3 */
9562306a36Sopenharmony_ci#define QLA82XX_HW_PH_CRB_AGT_ADR	0x1A
9662306a36Sopenharmony_ci#define QLA82XX_HW_SRE_CRB_AGT_ADR	0x50
9762306a36Sopenharmony_ci#define QLA82XX_HW_EG_CRB_AGT_ADR	0x51
9862306a36Sopenharmony_ci#define QLA82XX_HW_RPMX0_CRB_AGT_ADR	0x08
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci/*  Hub 4 */
10162306a36Sopenharmony_ci#define QLA82XX_HW_PEGN0_CRB_AGT_ADR	0x40
10262306a36Sopenharmony_ci#define QLA82XX_HW_PEGN1_CRB_AGT_ADR	0x41
10362306a36Sopenharmony_ci#define QLA82XX_HW_PEGN2_CRB_AGT_ADR	0x42
10462306a36Sopenharmony_ci#define QLA82XX_HW_PEGN3_CRB_AGT_ADR	0x43
10562306a36Sopenharmony_ci#define QLA82XX_HW_PEGNI_CRB_AGT_ADR	0x44
10662306a36Sopenharmony_ci#define QLA82XX_HW_PEGND_CRB_AGT_ADR	0x45
10762306a36Sopenharmony_ci#define QLA82XX_HW_PEGNC_CRB_AGT_ADR	0x46
10862306a36Sopenharmony_ci#define QLA82XX_HW_PEGR0_CRB_AGT_ADR	0x47
10962306a36Sopenharmony_ci#define QLA82XX_HW_PEGR1_CRB_AGT_ADR	0x48
11062306a36Sopenharmony_ci#define QLA82XX_HW_PEGR2_CRB_AGT_ADR	0x49
11162306a36Sopenharmony_ci#define QLA82XX_HW_PEGR3_CRB_AGT_ADR	0x4a
11262306a36Sopenharmony_ci#define QLA82XX_HW_PEGN4_CRB_AGT_ADR	0x4b
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci/*  Hub 5 */
11562306a36Sopenharmony_ci#define QLA82XX_HW_PEGS0_CRB_AGT_ADR	0x40
11662306a36Sopenharmony_ci#define QLA82XX_HW_PEGS1_CRB_AGT_ADR	0x41
11762306a36Sopenharmony_ci#define QLA82XX_HW_PEGS2_CRB_AGT_ADR	0x42
11862306a36Sopenharmony_ci#define QLA82XX_HW_PEGS3_CRB_AGT_ADR	0x43
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci#define QLA82XX_HW_PEGSI_CRB_AGT_ADR	0x44
12162306a36Sopenharmony_ci#define QLA82XX_HW_PEGSD_CRB_AGT_ADR	0x45
12262306a36Sopenharmony_ci#define QLA82XX_HW_PEGSC_CRB_AGT_ADR	0x46
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci/*  Hub 6 */
12562306a36Sopenharmony_ci#define QLA82XX_HW_CAS0_CRB_AGT_ADR	0x46
12662306a36Sopenharmony_ci#define QLA82XX_HW_CAS1_CRB_AGT_ADR	0x47
12762306a36Sopenharmony_ci#define QLA82XX_HW_CAS2_CRB_AGT_ADR	0x48
12862306a36Sopenharmony_ci#define QLA82XX_HW_CAS3_CRB_AGT_ADR	0x49
12962306a36Sopenharmony_ci#define QLA82XX_HW_NCM_CRB_AGT_ADR	0x16
13062306a36Sopenharmony_ci#define QLA82XX_HW_TMR_CRB_AGT_ADR	0x17
13162306a36Sopenharmony_ci#define QLA82XX_HW_XDMA_CRB_AGT_ADR	0x05
13262306a36Sopenharmony_ci#define QLA82XX_HW_OCM0_CRB_AGT_ADR	0x06
13362306a36Sopenharmony_ci#define QLA82XX_HW_OCM1_CRB_AGT_ADR	0x07
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci/*  This field defines PCI/X adr [25:20] of agents on the CRB */
13662306a36Sopenharmony_ci/*  */
13762306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PH	0
13862306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PS	1
13962306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_MN	2
14062306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_MS	3
14162306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SRE	5
14262306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_NIU	6
14362306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_QMN	7
14462306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQN0	8
14562306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQN1	9
14662306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQN2	10
14762306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQN3	11
14862306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_QMS	12
14962306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQS0	13
15062306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQS1	14
15162306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQS2	15
15262306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SQS3	16
15362306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGN0	17
15462306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGN1	18
15562306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGN2	19
15662306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGN3	20
15762306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGN4	QLA82XX_HW_PX_MAP_CRB_SQS2
15862306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGND	21
15962306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGNI	22
16062306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGS0	23
16162306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGS1	24
16262306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGS2	25
16362306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGS3	26
16462306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGSD	27
16562306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGSI	28
16662306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SN	29
16762306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_EG	31
16862306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PH2	32
16962306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PS2	33
17062306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_CAM	34
17162306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_CAS0	35
17262306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_CAS1	36
17362306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_CAS2	37
17462306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_C2C0	38
17562306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_C2C1	39
17662306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_TIMR	40
17762306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX1	42
17862306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX2	43
17962306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX3	44
18062306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX4	45
18162306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX5	46
18262306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX6	47
18362306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX7	48
18462306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_XDMA	49
18562306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_I2Q	50
18662306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_ROMUSB    51
18762306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_CAS3	52
18862306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX0	53
18962306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX8	54
19062306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_RPMX9	55
19162306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_OCM0	56
19262306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_OCM1	57
19362306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_SMB	58
19462306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_I2C0	59
19562306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_I2C1	60
19662306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_LPC	61
19762306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGNC	62
19862306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGR0	63
19962306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGR1	4
20062306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGR2	30
20162306a36Sopenharmony_ci#define QLA82XX_HW_PX_MAP_CRB_PGR3	41
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci/*  This field defines CRB adr [31:20] of the agents */
20462306a36Sopenharmony_ci/*  */
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_MN	((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
20762306a36Sopenharmony_ci					QLA82XX_HW_MN_CRB_AGT_ADR)
20862306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PH	((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
20962306a36Sopenharmony_ci					QLA82XX_HW_PH_CRB_AGT_ADR)
21062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_MS	((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
21162306a36Sopenharmony_ci					QLA82XX_HW_MS_CRB_AGT_ADR)
21262306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PS	((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
21362306a36Sopenharmony_ci					QLA82XX_HW_PS_CRB_AGT_ADR)
21462306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SS	((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
21562306a36Sopenharmony_ci					QLA82XX_HW_SS_CRB_AGT_ADR)
21662306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX3    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
21762306a36Sopenharmony_ci					    QLA82XX_HW_RPMX3_CRB_AGT_ADR)
21862306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_QMS	    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
21962306a36Sopenharmony_ci					    QLA82XX_HW_QMS_CRB_AGT_ADR)
22062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS0     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
22162306a36Sopenharmony_ci					    QLA82XX_HW_SQGS0_CRB_AGT_ADR)
22262306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS1     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
22362306a36Sopenharmony_ci					    QLA82XX_HW_SQGS1_CRB_AGT_ADR)
22462306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS2     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
22562306a36Sopenharmony_ci					    QLA82XX_HW_SQGS2_CRB_AGT_ADR)
22662306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS3     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
22762306a36Sopenharmony_ci					    QLA82XX_HW_SQGS3_CRB_AGT_ADR)
22862306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_C2C0     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
22962306a36Sopenharmony_ci					    QLA82XX_HW_C2C0_CRB_AGT_ADR)
23062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_C2C1     ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
23162306a36Sopenharmony_ci					    QLA82XX_HW_C2C1_CRB_AGT_ADR)
23262306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX2    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
23362306a36Sopenharmony_ci					    QLA82XX_HW_RPMX2_CRB_AGT_ADR)
23462306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX4    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
23562306a36Sopenharmony_ci					    QLA82XX_HW_RPMX4_CRB_AGT_ADR)
23662306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX7    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
23762306a36Sopenharmony_ci					    QLA82XX_HW_RPMX7_CRB_AGT_ADR)
23862306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX9    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
23962306a36Sopenharmony_ci					    QLA82XX_HW_RPMX9_CRB_AGT_ADR)
24062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SMB	    ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
24162306a36Sopenharmony_ci					    QLA82XX_HW_SMB_CRB_AGT_ADR)
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_NIU      ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
24462306a36Sopenharmony_ci					    QLA82XX_HW_NIU_CRB_AGT_ADR)
24562306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_I2C0     ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
24662306a36Sopenharmony_ci					    QLA82XX_HW_I2C0_CRB_AGT_ADR)
24762306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_I2C1     ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
24862306a36Sopenharmony_ci					    QLA82XX_HW_I2C1_CRB_AGT_ADR)
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SRE      ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
25162306a36Sopenharmony_ci					    QLA82XX_HW_SRE_CRB_AGT_ADR)
25262306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_EG       ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
25362306a36Sopenharmony_ci					    QLA82XX_HW_EG_CRB_AGT_ADR)
25462306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX0    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
25562306a36Sopenharmony_ci					    QLA82XX_HW_RPMX0_CRB_AGT_ADR)
25662306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_QMN      ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
25762306a36Sopenharmony_ci					    QLA82XX_HW_QM_CRB_AGT_ADR)
25862306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN0     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
25962306a36Sopenharmony_ci					    QLA82XX_HW_SQG0_CRB_AGT_ADR)
26062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN1     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
26162306a36Sopenharmony_ci					    QLA82XX_HW_SQG1_CRB_AGT_ADR)
26262306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN2     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
26362306a36Sopenharmony_ci					    QLA82XX_HW_SQG2_CRB_AGT_ADR)
26462306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN3     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
26562306a36Sopenharmony_ci					    QLA82XX_HW_SQG3_CRB_AGT_ADR)
26662306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX1    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
26762306a36Sopenharmony_ci					    QLA82XX_HW_RPMX1_CRB_AGT_ADR)
26862306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX5    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
26962306a36Sopenharmony_ci					    QLA82XX_HW_RPMX5_CRB_AGT_ADR)
27062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX6    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
27162306a36Sopenharmony_ci					    QLA82XX_HW_RPMX6_CRB_AGT_ADR)
27262306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX8    ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
27362306a36Sopenharmony_ci					    QLA82XX_HW_RPMX8_CRB_AGT_ADR)
27462306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS0     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
27562306a36Sopenharmony_ci					    QLA82XX_HW_CAS0_CRB_AGT_ADR)
27662306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS1     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
27762306a36Sopenharmony_ci					    QLA82XX_HW_CAS1_CRB_AGT_ADR)
27862306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS2     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
27962306a36Sopenharmony_ci					    QLA82XX_HW_CAS2_CRB_AGT_ADR)
28062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS3     ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
28162306a36Sopenharmony_ci					    QLA82XX_HW_CAS3_CRB_AGT_ADR)
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGNI     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
28462306a36Sopenharmony_ci					    QLA82XX_HW_PEGNI_CRB_AGT_ADR)
28562306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGND     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
28662306a36Sopenharmony_ci					    QLA82XX_HW_PEGND_CRB_AGT_ADR)
28762306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN0     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
28862306a36Sopenharmony_ci					    QLA82XX_HW_PEGN0_CRB_AGT_ADR)
28962306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN1     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
29062306a36Sopenharmony_ci					    QLA82XX_HW_PEGN1_CRB_AGT_ADR)
29162306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN2     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
29262306a36Sopenharmony_ci					    QLA82XX_HW_PEGN2_CRB_AGT_ADR)
29362306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN3     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
29462306a36Sopenharmony_ci					    QLA82XX_HW_PEGN3_CRB_AGT_ADR)
29562306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN4     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
29662306a36Sopenharmony_ci					    QLA82XX_HW_PEGN4_CRB_AGT_ADR)
29762306a36Sopenharmony_ci
29862306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGNC     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
29962306a36Sopenharmony_ci					    QLA82XX_HW_PEGNC_CRB_AGT_ADR)
30062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR0     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
30162306a36Sopenharmony_ci					    QLA82XX_HW_PEGR0_CRB_AGT_ADR)
30262306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR1     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
30362306a36Sopenharmony_ci					    QLA82XX_HW_PEGR1_CRB_AGT_ADR)
30462306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR2     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
30562306a36Sopenharmony_ci					    QLA82XX_HW_PEGR2_CRB_AGT_ADR)
30662306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR3     ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
30762306a36Sopenharmony_ci					    QLA82XX_HW_PEGR3_CRB_AGT_ADR)
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSI     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
31062306a36Sopenharmony_ci					    QLA82XX_HW_PEGSI_CRB_AGT_ADR)
31162306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSD     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
31262306a36Sopenharmony_ci					    QLA82XX_HW_PEGSD_CRB_AGT_ADR)
31362306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS0     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
31462306a36Sopenharmony_ci					    QLA82XX_HW_PEGS0_CRB_AGT_ADR)
31562306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS1     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
31662306a36Sopenharmony_ci					    QLA82XX_HW_PEGS1_CRB_AGT_ADR)
31762306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS2     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
31862306a36Sopenharmony_ci					    QLA82XX_HW_PEGS2_CRB_AGT_ADR)
31962306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS3     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
32062306a36Sopenharmony_ci					    QLA82XX_HW_PEGS3_CRB_AGT_ADR)
32162306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSC     ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
32262306a36Sopenharmony_ci					    QLA82XX_HW_PEGSC_CRB_AGT_ADR)
32362306a36Sopenharmony_ci
32462306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_CAM      ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
32562306a36Sopenharmony_ci					    QLA82XX_HW_NCM_CRB_AGT_ADR)
32662306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_TIMR     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
32762306a36Sopenharmony_ci					    QLA82XX_HW_TMR_CRB_AGT_ADR)
32862306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_XDMA     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
32962306a36Sopenharmony_ci					    QLA82XX_HW_XDMA_CRB_AGT_ADR)
33062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_SN       ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
33162306a36Sopenharmony_ci					    QLA82XX_HW_SN_CRB_AGT_ADR)
33262306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_I2Q      ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
33362306a36Sopenharmony_ci					    QLA82XX_HW_I2Q_CRB_AGT_ADR)
33462306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_ROMUSB   ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
33562306a36Sopenharmony_ci					    QLA82XX_HW_ROMUSB_CRB_AGT_ADR)
33662306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_OCM0     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
33762306a36Sopenharmony_ci					    QLA82XX_HW_OCM0_CRB_AGT_ADR)
33862306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_OCM1     ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
33962306a36Sopenharmony_ci					    QLA82XX_HW_OCM1_CRB_AGT_ADR)
34062306a36Sopenharmony_ci#define QLA82XX_HW_CRB_HUB_AGT_ADR_LPC      ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
34162306a36Sopenharmony_ci					    QLA82XX_HW_LPC_CRB_AGT_ADR)
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ci#define ROMUSB_GLB	(QLA82XX_CRB_ROMUSB + 0x00000)
34462306a36Sopenharmony_ci#define QLA82XX_ROMUSB_GLB_PEGTUNE_DONE		(ROMUSB_GLB + 0x005c)
34562306a36Sopenharmony_ci#define QLA82XX_ROMUSB_GLB_STATUS		(ROMUSB_GLB + 0x0004)
34662306a36Sopenharmony_ci#define QLA82XX_ROMUSB_GLB_SW_RESET		(ROMUSB_GLB + 0x0008)
34762306a36Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_ADDRESS		(ROMUSB_ROM + 0x0008)
34862306a36Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_WDATA		(ROMUSB_ROM + 0x000c)
34962306a36Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_ABYTE_CNT		(ROMUSB_ROM + 0x0010)
35062306a36Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_DUMMY_BYTE_CNT	(ROMUSB_ROM + 0x0014)
35162306a36Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_RDATA		(ROMUSB_ROM + 0x0018)
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ci#define ROMUSB_ROM	(QLA82XX_CRB_ROMUSB + 0x10000)
35462306a36Sopenharmony_ci#define QLA82XX_ROMUSB_ROM_INSTR_OPCODE	(ROMUSB_ROM + 0x0004)
35562306a36Sopenharmony_ci#define QLA82XX_ROMUSB_GLB_CAS_RST	(ROMUSB_GLB + 0x0038)
35662306a36Sopenharmony_ci
35762306a36Sopenharmony_ci/* Lock IDs for ROM lock */
35862306a36Sopenharmony_ci#define ROM_LOCK_DRIVER		0x0d417340
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ci#define QLA82XX_PCI_CRB_WINDOWSIZE	0x00100000    /* all are 1MB windows */
36162306a36Sopenharmony_ci#define QLA82XX_PCI_CRB_WINDOW(A)	(QLA82XX_PCI_CRBSPACE + \
36262306a36Sopenharmony_ci					(A)*QLA82XX_PCI_CRB_WINDOWSIZE)
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_ci#define QLA82XX_CRB_C2C_0 \
36562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C0)
36662306a36Sopenharmony_ci#define QLA82XX_CRB_C2C_1 \
36762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C1)
36862306a36Sopenharmony_ci#define QLA82XX_CRB_C2C_2 \
36962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C2)
37062306a36Sopenharmony_ci#define QLA82XX_CRB_CAM	\
37162306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAM)
37262306a36Sopenharmony_ci#define QLA82XX_CRB_CASPER \
37362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS)
37462306a36Sopenharmony_ci#define QLA82XX_CRB_CASPER_0 \
37562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS0)
37662306a36Sopenharmony_ci#define QLA82XX_CRB_CASPER_1 \
37762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS1)
37862306a36Sopenharmony_ci#define QLA82XX_CRB_CASPER_2 \
37962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS2)
38062306a36Sopenharmony_ci#define QLA82XX_CRB_DDR_MD \
38162306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_MS)
38262306a36Sopenharmony_ci#define QLA82XX_CRB_DDR_NET \
38362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_MN)
38462306a36Sopenharmony_ci#define QLA82XX_CRB_EPG \
38562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_EG)
38662306a36Sopenharmony_ci#define QLA82XX_CRB_I2Q \
38762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2Q)
38862306a36Sopenharmony_ci#define QLA82XX_CRB_NIU	\
38962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_NIU)
39062306a36Sopenharmony_ci/* HACK upon HACK upon HACK (for PCIE builds) */
39162306a36Sopenharmony_ci#define QLA82XX_CRB_PCIX_HOST \
39262306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PH)
39362306a36Sopenharmony_ci#define QLA82XX_CRB_PCIX_HOST2 \
39462306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PH2)
39562306a36Sopenharmony_ci#define QLA82XX_CRB_PCIX_MD \
39662306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PS)
39762306a36Sopenharmony_ci#define QLA82XX_CRB_PCIE	QLA82XX_CRB_PCIX_MD
39862306a36Sopenharmony_ci/* window 1 pcie slot */
39962306a36Sopenharmony_ci#define QLA82XX_CRB_PCIE2 \
40062306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PS2)
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_0 \
40362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS0)
40462306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_1 \
40562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS1)
40662306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_2 \
40762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS2)
40862306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_3 \
40962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS3)
41062306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_3 \
41162306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS3)
41262306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_D \
41362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGSD)
41462306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_MD_I \
41562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGSI)
41662306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_0 \
41762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN0)
41862306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_1 \
41962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN1)
42062306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_2 \
42162306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN2)
42262306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_3 \
42362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN3)
42462306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_4 \
42562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN4)
42662306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_D \
42762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGND)
42862306a36Sopenharmony_ci#define QLA82XX_CRB_PEG_NET_I \
42962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGNI)
43062306a36Sopenharmony_ci#define QLA82XX_CRB_PQM_MD \
43162306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_QMS)
43262306a36Sopenharmony_ci#define QLA82XX_CRB_PQM_NET \
43362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_QMN)
43462306a36Sopenharmony_ci#define QLA82XX_CRB_QDR_MD \
43562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SS)
43662306a36Sopenharmony_ci#define QLA82XX_CRB_QDR_NET \
43762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SN)
43862306a36Sopenharmony_ci#define QLA82XX_CRB_ROMUSB \
43962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_ROMUSB)
44062306a36Sopenharmony_ci#define QLA82XX_CRB_RPMX_0 \
44162306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX0)
44262306a36Sopenharmony_ci#define QLA82XX_CRB_RPMX_1 \
44362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX1)
44462306a36Sopenharmony_ci#define QLA82XX_CRB_RPMX_2 \
44562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX2)
44662306a36Sopenharmony_ci#define QLA82XX_CRB_RPMX_3 \
44762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX3)
44862306a36Sopenharmony_ci#define QLA82XX_CRB_RPMX_4 \
44962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX4)
45062306a36Sopenharmony_ci#define QLA82XX_CRB_RPMX_5 \
45162306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX5)
45262306a36Sopenharmony_ci#define QLA82XX_CRB_RPMX_6 \
45362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX6)
45462306a36Sopenharmony_ci#define QLA82XX_CRB_RPMX_7 \
45562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX7)
45662306a36Sopenharmony_ci#define QLA82XX_CRB_SQM_MD_0 \
45762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS0)
45862306a36Sopenharmony_ci#define QLA82XX_CRB_SQM_MD_1 \
45962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS1)
46062306a36Sopenharmony_ci#define QLA82XX_CRB_SQM_MD_2 \
46162306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS2)
46262306a36Sopenharmony_ci#define QLA82XX_CRB_SQM_MD_3 \
46362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS3)
46462306a36Sopenharmony_ci#define QLA82XX_CRB_SQM_NET_0 \
46562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN0)
46662306a36Sopenharmony_ci#define QLA82XX_CRB_SQM_NET_1 \
46762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN1)
46862306a36Sopenharmony_ci#define QLA82XX_CRB_SQM_NET_2 \
46962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN2)
47062306a36Sopenharmony_ci#define QLA82XX_CRB_SQM_NET_3 \
47162306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN3)
47262306a36Sopenharmony_ci#define QLA82XX_CRB_SRE \
47362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SRE)
47462306a36Sopenharmony_ci#define QLA82XX_CRB_TIMER \
47562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_TIMR)
47662306a36Sopenharmony_ci#define QLA82XX_CRB_XDMA \
47762306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_XDMA)
47862306a36Sopenharmony_ci#define QLA82XX_CRB_I2C0 \
47962306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2C0)
48062306a36Sopenharmony_ci#define QLA82XX_CRB_I2C1 \
48162306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2C1)
48262306a36Sopenharmony_ci#define QLA82XX_CRB_OCM0 \
48362306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_OCM0)
48462306a36Sopenharmony_ci#define QLA82XX_CRB_SMB \
48562306a36Sopenharmony_ci	QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SMB)
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_ci#define QLA82XX_CRB_MAX		QLA82XX_PCI_CRB_WINDOW(64)
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci/*
49062306a36Sopenharmony_ci * ====================== BASE ADDRESSES ON-CHIP ======================
49162306a36Sopenharmony_ci * Base addresses of major components on-chip.
49262306a36Sopenharmony_ci * ====================== BASE ADDRESSES ON-CHIP ======================
49362306a36Sopenharmony_ci */
49462306a36Sopenharmony_ci#define QLA8XXX_ADDR_DDR_NET		(0x0000000000000000ULL)
49562306a36Sopenharmony_ci#define QLA8XXX_ADDR_DDR_NET_MAX	(0x000000000fffffffULL)
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci/* Imbus address bit used to indicate a host address. This bit is
49862306a36Sopenharmony_ci * eliminated by the pcie bar and bar select before presentation
49962306a36Sopenharmony_ci * over pcie. */
50062306a36Sopenharmony_ci/* host memory via IMBUS */
50162306a36Sopenharmony_ci#define QLA82XX_P2_ADDR_PCIE	(0x0000000800000000ULL)
50262306a36Sopenharmony_ci#define QLA82XX_P3_ADDR_PCIE	(0x0000008000000000ULL)
50362306a36Sopenharmony_ci#define QLA82XX_ADDR_PCIE_MAX	(0x0000000FFFFFFFFFULL)
50462306a36Sopenharmony_ci#define QLA8XXX_ADDR_OCM0	(0x0000000200000000ULL)
50562306a36Sopenharmony_ci#define QLA8XXX_ADDR_OCM0_MAX	(0x00000002000fffffULL)
50662306a36Sopenharmony_ci#define QLA8XXX_ADDR_OCM1	(0x0000000200400000ULL)
50762306a36Sopenharmony_ci#define QLA8XXX_ADDR_OCM1_MAX	(0x00000002004fffffULL)
50862306a36Sopenharmony_ci#define QLA8XXX_ADDR_QDR_NET	(0x0000000300000000ULL)
50962306a36Sopenharmony_ci
51062306a36Sopenharmony_ci#define QLA82XX_P2_ADDR_QDR_NET_MAX	(0x00000003001fffffULL)
51162306a36Sopenharmony_ci#define QLA82XX_P3_ADDR_QDR_NET_MAX	(0x0000000303ffffffULL)
51262306a36Sopenharmony_ci#define QLA8XXX_ADDR_QDR_NET_MAX	(0x0000000307ffffffULL)
51362306a36Sopenharmony_ci
51462306a36Sopenharmony_ci#define QLA82XX_PCI_CRBSPACE		(unsigned long)0x06000000
51562306a36Sopenharmony_ci#define QLA82XX_PCI_DIRECT_CRB		(unsigned long)0x04400000
51662306a36Sopenharmony_ci#define QLA82XX_PCI_CAMQM		(unsigned long)0x04800000
51762306a36Sopenharmony_ci#define QLA82XX_PCI_CAMQM_MAX		(unsigned long)0x04ffffff
51862306a36Sopenharmony_ci#define QLA82XX_PCI_DDR_NET		(unsigned long)0x00000000
51962306a36Sopenharmony_ci#define QLA82XX_PCI_QDR_NET		(unsigned long)0x04000000
52062306a36Sopenharmony_ci#define QLA82XX_PCI_QDR_NET_MAX		(unsigned long)0x043fffff
52162306a36Sopenharmony_ci
52262306a36Sopenharmony_ci/*  PCI Windowing for DDR regions.  */
52362306a36Sopenharmony_ci#define QLA8XXX_ADDR_IN_RANGE(addr, low, high)            \
52462306a36Sopenharmony_ci	(((addr) <= (high)) && ((addr) >= (low)))
52562306a36Sopenharmony_ci
52662306a36Sopenharmony_ci/*
52762306a36Sopenharmony_ci *   Register offsets for MN
52862306a36Sopenharmony_ci */
52962306a36Sopenharmony_ci#define MIU_CONTROL			(0x000)
53062306a36Sopenharmony_ci#define MIU_TAG				(0x004)
53162306a36Sopenharmony_ci#define MIU_TEST_AGT_CTRL		(0x090)
53262306a36Sopenharmony_ci#define MIU_TEST_AGT_ADDR_LO		(0x094)
53362306a36Sopenharmony_ci#define MIU_TEST_AGT_ADDR_HI		(0x098)
53462306a36Sopenharmony_ci#define MIU_TEST_AGT_WRDATA_LO		(0x0a0)
53562306a36Sopenharmony_ci#define MIU_TEST_AGT_WRDATA_HI		(0x0a4)
53662306a36Sopenharmony_ci#define MIU_TEST_AGT_WRDATA(i)		(0x0a0+(4*(i)))
53762306a36Sopenharmony_ci#define MIU_TEST_AGT_RDDATA_LO		(0x0a8)
53862306a36Sopenharmony_ci#define MIU_TEST_AGT_RDDATA_HI		(0x0ac)
53962306a36Sopenharmony_ci#define MIU_TEST_AGT_RDDATA(i)		(0x0a8+(4*(i)))
54062306a36Sopenharmony_ci#define MIU_TEST_AGT_ADDR_MASK		0xfffffff8
54162306a36Sopenharmony_ci#define MIU_TEST_AGT_UPPER_ADDR(off)	(0)
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_ci/* MIU_TEST_AGT_CTRL flags. work for SIU as well */
54462306a36Sopenharmony_ci#define MIU_TA_CTL_START	1
54562306a36Sopenharmony_ci#define MIU_TA_CTL_ENABLE	2
54662306a36Sopenharmony_ci#define MIU_TA_CTL_WRITE	4
54762306a36Sopenharmony_ci#define MIU_TA_CTL_BUSY		8
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_ci#define MIU_TA_CTL_WRITE_ENABLE		(MIU_TA_CTL_WRITE | MIU_TA_CTL_ENABLE)
55062306a36Sopenharmony_ci#define MIU_TA_CTL_WRITE_START		(MIU_TA_CTL_WRITE | MIU_TA_CTL_ENABLE |\
55162306a36Sopenharmony_ci					 MIU_TA_CTL_START)
55262306a36Sopenharmony_ci#define MIU_TA_CTL_START_ENABLE		(MIU_TA_CTL_START | MIU_TA_CTL_ENABLE)
55362306a36Sopenharmony_ci
55462306a36Sopenharmony_ci/*CAM RAM */
55562306a36Sopenharmony_ci# define QLA82XX_CAM_RAM_BASE	(QLA82XX_CRB_CAM + 0x02000)
55662306a36Sopenharmony_ci# define QLA82XX_CAM_RAM(reg)	(QLA82XX_CAM_RAM_BASE + (reg))
55762306a36Sopenharmony_ci
55862306a36Sopenharmony_ci#define QLA82XX_PORT_MODE_ADDR		(QLA82XX_CAM_RAM(0x24))
55962306a36Sopenharmony_ci#define QLA82XX_PEG_HALT_STATUS1	(QLA82XX_CAM_RAM(0xa8))
56062306a36Sopenharmony_ci#define QLA82XX_PEG_HALT_STATUS2	(QLA82XX_CAM_RAM(0xac))
56162306a36Sopenharmony_ci#define QLA82XX_PEG_ALIVE_COUNTER	(QLA82XX_CAM_RAM(0xb0))
56262306a36Sopenharmony_ci#define QLA82XX_CAM_RAM_DB1		(QLA82XX_CAM_RAM(0x1b0))
56362306a36Sopenharmony_ci#define QLA82XX_CAM_RAM_DB2		(QLA82XX_CAM_RAM(0x1b4))
56462306a36Sopenharmony_ci
56562306a36Sopenharmony_ci#define HALT_STATUS_UNRECOVERABLE	0x80000000
56662306a36Sopenharmony_ci#define HALT_STATUS_RECOVERABLE		0x40000000
56762306a36Sopenharmony_ci
56862306a36Sopenharmony_ci
56962306a36Sopenharmony_ci#define QLA82XX_ROM_LOCK_ID		(QLA82XX_CAM_RAM(0x100))
57062306a36Sopenharmony_ci#define QLA82XX_CRB_WIN_LOCK_ID		(QLA82XX_CAM_RAM(0x124))
57162306a36Sopenharmony_ci#define QLA82XX_FW_VERSION_MAJOR	(QLA82XX_CAM_RAM(0x150))
57262306a36Sopenharmony_ci#define QLA82XX_FW_VERSION_MINOR	(QLA82XX_CAM_RAM(0x154))
57362306a36Sopenharmony_ci#define QLA82XX_FW_VERSION_SUB		(QLA82XX_CAM_RAM(0x158))
57462306a36Sopenharmony_ci#define QLA82XX_PCIE_REG(reg)		(QLA82XX_CRB_PCIE + (reg))
57562306a36Sopenharmony_ci
57662306a36Sopenharmony_ci/* Driver Coexistence Defines */
57762306a36Sopenharmony_ci#define QLA82XX_CRB_DRV_ACTIVE		(QLA82XX_CAM_RAM(0x138))
57862306a36Sopenharmony_ci#define QLA82XX_CRB_DEV_STATE		(QLA82XX_CAM_RAM(0x140))
57962306a36Sopenharmony_ci#define QLA82XX_CRB_DRV_STATE		(QLA82XX_CAM_RAM(0x144))
58062306a36Sopenharmony_ci#define QLA82XX_CRB_DRV_SCRATCH		(QLA82XX_CAM_RAM(0x148))
58162306a36Sopenharmony_ci#define QLA82XX_CRB_DEV_PART_INFO	(QLA82XX_CAM_RAM(0x14c))
58262306a36Sopenharmony_ci#define QLA82XX_CRB_DRV_IDC_VERSION	(QLA82XX_CAM_RAM(0x174))
58362306a36Sopenharmony_ci
58462306a36Sopenharmony_cienum qla_regs {
58562306a36Sopenharmony_ci	QLA8XXX_PEG_HALT_STATUS1 = 0,
58662306a36Sopenharmony_ci	QLA8XXX_PEG_HALT_STATUS2,
58762306a36Sopenharmony_ci	QLA8XXX_PEG_ALIVE_COUNTER,
58862306a36Sopenharmony_ci	QLA8XXX_CRB_DRV_ACTIVE,
58962306a36Sopenharmony_ci	QLA8XXX_CRB_DEV_STATE,
59062306a36Sopenharmony_ci	QLA8XXX_CRB_DRV_STATE,
59162306a36Sopenharmony_ci	QLA8XXX_CRB_DRV_SCRATCH,
59262306a36Sopenharmony_ci	QLA8XXX_CRB_DEV_PART_INFO,
59362306a36Sopenharmony_ci	QLA8XXX_CRB_DRV_IDC_VERSION,
59462306a36Sopenharmony_ci	QLA8XXX_FW_VERSION_MAJOR,
59562306a36Sopenharmony_ci	QLA8XXX_FW_VERSION_MINOR,
59662306a36Sopenharmony_ci	QLA8XXX_FW_VERSION_SUB,
59762306a36Sopenharmony_ci	QLA8XXX_CRB_CMDPEG_STATE,
59862306a36Sopenharmony_ci	QLA8XXX_CRB_TEMP_STATE,
59962306a36Sopenharmony_ci};
60062306a36Sopenharmony_ci
60162306a36Sopenharmony_ci/* Every driver should use these Device State */
60262306a36Sopenharmony_ci#define QLA8XXX_DEV_COLD		1
60362306a36Sopenharmony_ci#define QLA8XXX_DEV_INITIALIZING	2
60462306a36Sopenharmony_ci#define QLA8XXX_DEV_READY		3
60562306a36Sopenharmony_ci#define QLA8XXX_DEV_NEED_RESET		4
60662306a36Sopenharmony_ci#define QLA8XXX_DEV_NEED_QUIESCENT	5
60762306a36Sopenharmony_ci#define QLA8XXX_DEV_FAILED		6
60862306a36Sopenharmony_ci#define QLA8XXX_DEV_QUIESCENT		7
60962306a36Sopenharmony_ci#define MAX_STATES			8 /* Increment if new state added */
61062306a36Sopenharmony_ci
61162306a36Sopenharmony_ci#define QLA82XX_IDC_VERSION		0x1
61262306a36Sopenharmony_ci#define ROM_DEV_INIT_TIMEOUT		30
61362306a36Sopenharmony_ci#define ROM_DRV_RESET_ACK_TIMEOUT	10
61462306a36Sopenharmony_ci
61562306a36Sopenharmony_ci#define PCIE_SETUP_FUNCTION		(0x12040)
61662306a36Sopenharmony_ci#define PCIE_SETUP_FUNCTION2		(0x12048)
61762306a36Sopenharmony_ci
61862306a36Sopenharmony_ci#define QLA82XX_PCIX_PS_REG(reg)	(QLA82XX_CRB_PCIX_MD + (reg))
61962306a36Sopenharmony_ci#define QLA82XX_PCIX_PS2_REG(reg)	(QLA82XX_CRB_PCIE2 + (reg))
62062306a36Sopenharmony_ci
62162306a36Sopenharmony_ci#define PCIE_SEM2_LOCK		(0x1c010)  /* Flash lock   */
62262306a36Sopenharmony_ci#define PCIE_SEM2_UNLOCK	(0x1c014)  /* Flash unlock */
62362306a36Sopenharmony_ci#define PCIE_SEM5_LOCK		(0x1c028)  /* Coexistence lock   */
62462306a36Sopenharmony_ci#define PCIE_SEM5_UNLOCK	(0x1c02c)  /* Coexistence unlock */
62562306a36Sopenharmony_ci#define PCIE_SEM7_LOCK		(0x1c038)  /* crb win lock */
62662306a36Sopenharmony_ci#define PCIE_SEM7_UNLOCK	(0x1c03c)  /* crbwin unlock*/
62762306a36Sopenharmony_ci
62862306a36Sopenharmony_ci/*
62962306a36Sopenharmony_ci * The PCI VendorID and DeviceID for our board.
63062306a36Sopenharmony_ci */
63162306a36Sopenharmony_ci#define QLA82XX_MSIX_TBL_SPACE		8192
63262306a36Sopenharmony_ci#define QLA82XX_PCI_REG_MSIX_TBL	0x44
63362306a36Sopenharmony_ci#define QLA82XX_PCI_MSIX_CONTROL	0x40
63462306a36Sopenharmony_ci
63562306a36Sopenharmony_cistruct crb_128M_2M_sub_block_map {
63662306a36Sopenharmony_ci	unsigned valid;
63762306a36Sopenharmony_ci	unsigned start_128M;
63862306a36Sopenharmony_ci	unsigned end_128M;
63962306a36Sopenharmony_ci	unsigned start_2M;
64062306a36Sopenharmony_ci};
64162306a36Sopenharmony_ci
64262306a36Sopenharmony_cistruct crb_128M_2M_block_map {
64362306a36Sopenharmony_ci	struct crb_128M_2M_sub_block_map sub_block[16];
64462306a36Sopenharmony_ci};
64562306a36Sopenharmony_ci
64662306a36Sopenharmony_cistruct crb_addr_pair {
64762306a36Sopenharmony_ci	long addr;
64862306a36Sopenharmony_ci	long data;
64962306a36Sopenharmony_ci};
65062306a36Sopenharmony_ci
65162306a36Sopenharmony_ci#define ADDR_ERROR	((unsigned long) 0xffffffff)
65262306a36Sopenharmony_ci#define MAX_CTL_CHECK	1000
65362306a36Sopenharmony_ci#define QLA82XX_FWERROR_CODE(code)	((code >> 8) & 0x1fffff)
65462306a36Sopenharmony_ci
65562306a36Sopenharmony_ci/***************************************************************************
65662306a36Sopenharmony_ci *		PCI related defines.
65762306a36Sopenharmony_ci **************************************************************************/
65862306a36Sopenharmony_ci
65962306a36Sopenharmony_ci/*
66062306a36Sopenharmony_ci * Interrupt related defines.
66162306a36Sopenharmony_ci */
66262306a36Sopenharmony_ci#define PCIX_TARGET_STATUS	(0x10118)
66362306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F1	(0x10160)
66462306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F2	(0x10164)
66562306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F3	(0x10168)
66662306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F4	(0x10360)
66762306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F5	(0x10364)
66862306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F6	(0x10368)
66962306a36Sopenharmony_ci#define PCIX_TARGET_STATUS_F7	(0x1036c)
67062306a36Sopenharmony_ci
67162306a36Sopenharmony_ci#define PCIX_TARGET_MASK	(0x10128)
67262306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F1	(0x10170)
67362306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F2	(0x10174)
67462306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F3	(0x10178)
67562306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F4	(0x10370)
67662306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F5	(0x10374)
67762306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F6	(0x10378)
67862306a36Sopenharmony_ci#define PCIX_TARGET_MASK_F7	(0x1037c)
67962306a36Sopenharmony_ci
68062306a36Sopenharmony_ci/*
68162306a36Sopenharmony_ci * Message Signaled Interrupts
68262306a36Sopenharmony_ci */
68362306a36Sopenharmony_ci#define PCIX_MSI_F0		(0x13000)
68462306a36Sopenharmony_ci#define PCIX_MSI_F1		(0x13004)
68562306a36Sopenharmony_ci#define PCIX_MSI_F2		(0x13008)
68662306a36Sopenharmony_ci#define PCIX_MSI_F3		(0x1300c)
68762306a36Sopenharmony_ci#define PCIX_MSI_F4		(0x13010)
68862306a36Sopenharmony_ci#define PCIX_MSI_F5		(0x13014)
68962306a36Sopenharmony_ci#define PCIX_MSI_F6		(0x13018)
69062306a36Sopenharmony_ci#define PCIX_MSI_F7		(0x1301c)
69162306a36Sopenharmony_ci#define PCIX_MSI_F(FUNC)	(0x13000 + ((FUNC) * 4))
69262306a36Sopenharmony_ci
69362306a36Sopenharmony_ci/*
69462306a36Sopenharmony_ci *
69562306a36Sopenharmony_ci */
69662306a36Sopenharmony_ci#define PCIX_INT_VECTOR		(0x10100)
69762306a36Sopenharmony_ci#define PCIX_INT_MASK		(0x10104)
69862306a36Sopenharmony_ci
69962306a36Sopenharmony_ci/*
70062306a36Sopenharmony_ci * Interrupt state machine and other bits.
70162306a36Sopenharmony_ci */
70262306a36Sopenharmony_ci#define PCIE_MISCCFG_RC		(0x1206c)
70362306a36Sopenharmony_ci
70462306a36Sopenharmony_ci
70562306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS \
70662306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS))
70762306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F1 \
70862306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F1))
70962306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F2 \
71062306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F2))
71162306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F3 \
71262306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F3))
71362306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F4 \
71462306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F4))
71562306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F5 \
71662306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F5))
71762306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F6 \
71862306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F6))
71962306a36Sopenharmony_ci#define ISR_INT_TARGET_STATUS_F7 \
72062306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F7))
72162306a36Sopenharmony_ci
72262306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK \
72362306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK))
72462306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F1 \
72562306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F1))
72662306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F2 \
72762306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F2))
72862306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F3 \
72962306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F3))
73062306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F4 \
73162306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F4))
73262306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F5 \
73362306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F5))
73462306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F6 \
73562306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F6))
73662306a36Sopenharmony_ci#define ISR_INT_TARGET_MASK_F7 \
73762306a36Sopenharmony_ci	(QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F7))
73862306a36Sopenharmony_ci
73962306a36Sopenharmony_ci#define ISR_INT_VECTOR			(QLA82XX_PCIX_PS_REG(PCIX_INT_VECTOR))
74062306a36Sopenharmony_ci#define ISR_INT_MASK			(QLA82XX_PCIX_PS_REG(PCIX_INT_MASK))
74162306a36Sopenharmony_ci#define ISR_INT_STATE_REG		(QLA82XX_PCIX_PS_REG(PCIE_MISCCFG_RC))
74262306a36Sopenharmony_ci
74362306a36Sopenharmony_ci#define	ISR_MSI_INT_TRIGGER(FUNC)	(QLA82XX_PCIX_PS_REG(PCIX_MSI_F(FUNC)))
74462306a36Sopenharmony_ci
74562306a36Sopenharmony_ci
74662306a36Sopenharmony_ci#define	ISR_IS_LEGACY_INTR_IDLE(VAL)		(((VAL) & 0x300) == 0)
74762306a36Sopenharmony_ci#define	ISR_IS_LEGACY_INTR_TRIGGERED(VAL)	(((VAL) & 0x300) == 0x200)
74862306a36Sopenharmony_ci
74962306a36Sopenharmony_ci/*
75062306a36Sopenharmony_ci * PCI Interrupt Vector Values.
75162306a36Sopenharmony_ci */
75262306a36Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F0	0x0080
75362306a36Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F1	0x0100
75462306a36Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F2	0x0200
75562306a36Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F3	0x0400
75662306a36Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F4	0x0800
75762306a36Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F5	0x1000
75862306a36Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F6	0x2000
75962306a36Sopenharmony_ci#define	PCIX_INT_VECTOR_BIT_F7	0x4000
76062306a36Sopenharmony_ci
76162306a36Sopenharmony_ci/* struct qla4_8xxx_legacy_intr_set defined in ql4_def.h */
76262306a36Sopenharmony_ci
76362306a36Sopenharmony_ci#define QLA82XX_LEGACY_INTR_CONFIG                                      \
76462306a36Sopenharmony_ci{                                                                       \
76562306a36Sopenharmony_ci	{                                                               \
76662306a36Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F0,         \
76762306a36Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS,          \
76862306a36Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK,            \
76962306a36Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(0) },       \
77062306a36Sopenharmony_ci									\
77162306a36Sopenharmony_ci	{								\
77262306a36Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F1,         \
77362306a36Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F1,       \
77462306a36Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F1,         \
77562306a36Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(1) },       \
77662306a36Sopenharmony_ci									\
77762306a36Sopenharmony_ci	{								\
77862306a36Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F2,         \
77962306a36Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F2,       \
78062306a36Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F2,         \
78162306a36Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(2) },       \
78262306a36Sopenharmony_ci									\
78362306a36Sopenharmony_ci	{								\
78462306a36Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F3,         \
78562306a36Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F3,       \
78662306a36Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F3,         \
78762306a36Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(3) },       \
78862306a36Sopenharmony_ci									\
78962306a36Sopenharmony_ci	{								\
79062306a36Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F4,         \
79162306a36Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F4,       \
79262306a36Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F4,         \
79362306a36Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(4) },       \
79462306a36Sopenharmony_ci									\
79562306a36Sopenharmony_ci	{								\
79662306a36Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F5,         \
79762306a36Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F5,       \
79862306a36Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F5,         \
79962306a36Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(5) },       \
80062306a36Sopenharmony_ci									\
80162306a36Sopenharmony_ci	{								\
80262306a36Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F6,         \
80362306a36Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F6,       \
80462306a36Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F6,         \
80562306a36Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(6) },       \
80662306a36Sopenharmony_ci									\
80762306a36Sopenharmony_ci	{								\
80862306a36Sopenharmony_ci		.int_vec_bit    =	PCIX_INT_VECTOR_BIT_F7,         \
80962306a36Sopenharmony_ci		.tgt_status_reg =	ISR_INT_TARGET_STATUS_F7,       \
81062306a36Sopenharmony_ci		.tgt_mask_reg   =	ISR_INT_TARGET_MASK_F7,         \
81162306a36Sopenharmony_ci		.pci_int_reg    =	ISR_MSI_INT_TRIGGER(7) },       \
81262306a36Sopenharmony_ci}
81362306a36Sopenharmony_ci
81462306a36Sopenharmony_ci/* Magic number to let user know flash is programmed */
81562306a36Sopenharmony_ci#define	QLA82XX_BDINFO_MAGIC	0x12345678
81662306a36Sopenharmony_ci#define FW_SIZE_OFFSET		(0x3e840c)
81762306a36Sopenharmony_ci
81862306a36Sopenharmony_ci/* QLA82XX additions */
81962306a36Sopenharmony_ci#define MIU_TEST_AGT_WRDATA_UPPER_LO	(0x0b0)
82062306a36Sopenharmony_ci#define	MIU_TEST_AGT_WRDATA_UPPER_HI	(0x0b4)
82162306a36Sopenharmony_ci
82262306a36Sopenharmony_ci/* Minidump related */
82362306a36Sopenharmony_ci
82462306a36Sopenharmony_ci/* Entry Type Defines */
82562306a36Sopenharmony_ci#define QLA8XXX_RDNOP	0
82662306a36Sopenharmony_ci#define QLA8XXX_RDCRB	1
82762306a36Sopenharmony_ci#define QLA8XXX_RDMUX	2
82862306a36Sopenharmony_ci#define QLA8XXX_QUEUE	3
82962306a36Sopenharmony_ci#define QLA8XXX_BOARD	4
83062306a36Sopenharmony_ci#define QLA8XXX_RDOCM	6
83162306a36Sopenharmony_ci#define QLA8XXX_PREGS	7
83262306a36Sopenharmony_ci#define QLA8XXX_L1DTG	8
83362306a36Sopenharmony_ci#define QLA8XXX_L1ITG	9
83462306a36Sopenharmony_ci#define QLA8XXX_L1DAT	11
83562306a36Sopenharmony_ci#define QLA8XXX_L1INS	12
83662306a36Sopenharmony_ci#define QLA8XXX_L2DTG	21
83762306a36Sopenharmony_ci#define QLA8XXX_L2ITG	22
83862306a36Sopenharmony_ci#define QLA8XXX_L2DAT	23
83962306a36Sopenharmony_ci#define QLA8XXX_L2INS	24
84062306a36Sopenharmony_ci#define QLA83XX_POLLRD	35
84162306a36Sopenharmony_ci#define QLA83XX_RDMUX2	36
84262306a36Sopenharmony_ci#define QLA83XX_POLLRDMWR  37
84362306a36Sopenharmony_ci#define QLA8044_RDDFE	38
84462306a36Sopenharmony_ci#define QLA8044_RDMDIO	39
84562306a36Sopenharmony_ci#define QLA8044_POLLWR	40
84662306a36Sopenharmony_ci#define QLA8XXX_RDROM	71
84762306a36Sopenharmony_ci#define QLA8XXX_RDMEM	72
84862306a36Sopenharmony_ci#define QLA8XXX_CNTRL	98
84962306a36Sopenharmony_ci#define QLA83XX_TLHDR	99
85062306a36Sopenharmony_ci#define QLA8XXX_RDEND	255
85162306a36Sopenharmony_ci
85262306a36Sopenharmony_ci/* Opcodes for Control Entries.
85362306a36Sopenharmony_ci * These Flags are bit fields.
85462306a36Sopenharmony_ci */
85562306a36Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_WR		0x01
85662306a36Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_RW		0x02
85762306a36Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_AND		0x04
85862306a36Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_OR		0x08
85962306a36Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_POLL		0x10
86062306a36Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_RDSTATE	0x20
86162306a36Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_WRSTATE	0x40
86262306a36Sopenharmony_ci#define QLA8XXX_DBG_OPCODE_MDSTATE	0x80
86362306a36Sopenharmony_ci
86462306a36Sopenharmony_ci/* Driver Flags */
86562306a36Sopenharmony_ci#define QLA8XXX_DBG_SKIPPED_FLAG	0x80 /* driver skipped this entry  */
86662306a36Sopenharmony_ci#define QLA8XXX_DBG_SIZE_ERR_FLAG	0x40 /* Entry vs Capture size
86762306a36Sopenharmony_ci					      * mismatch */
86862306a36Sopenharmony_ci
86962306a36Sopenharmony_ci/* Driver_code is for driver to write some info about the entry
87062306a36Sopenharmony_ci * currently not used.
87162306a36Sopenharmony_ci */
87262306a36Sopenharmony_cistruct qla8xxx_minidump_entry_hdr {
87362306a36Sopenharmony_ci	uint32_t entry_type;
87462306a36Sopenharmony_ci	uint32_t entry_size;
87562306a36Sopenharmony_ci	uint32_t entry_capture_size;
87662306a36Sopenharmony_ci	struct {
87762306a36Sopenharmony_ci		uint8_t entry_capture_mask;
87862306a36Sopenharmony_ci		uint8_t entry_code;
87962306a36Sopenharmony_ci		uint8_t driver_code;
88062306a36Sopenharmony_ci		uint8_t driver_flags;
88162306a36Sopenharmony_ci	} d_ctrl;
88262306a36Sopenharmony_ci};
88362306a36Sopenharmony_ci
88462306a36Sopenharmony_ci/*  Read CRB entry header */
88562306a36Sopenharmony_cistruct qla8xxx_minidump_entry_crb {
88662306a36Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
88762306a36Sopenharmony_ci	uint32_t addr;
88862306a36Sopenharmony_ci	struct {
88962306a36Sopenharmony_ci		uint8_t addr_stride;
89062306a36Sopenharmony_ci		uint8_t state_index_a;
89162306a36Sopenharmony_ci		uint16_t poll_timeout;
89262306a36Sopenharmony_ci	} crb_strd;
89362306a36Sopenharmony_ci	uint32_t data_size;
89462306a36Sopenharmony_ci	uint32_t op_count;
89562306a36Sopenharmony_ci
89662306a36Sopenharmony_ci	struct {
89762306a36Sopenharmony_ci		uint8_t opcode;
89862306a36Sopenharmony_ci		uint8_t state_index_v;
89962306a36Sopenharmony_ci		uint8_t shl;
90062306a36Sopenharmony_ci		uint8_t shr;
90162306a36Sopenharmony_ci	} crb_ctrl;
90262306a36Sopenharmony_ci
90362306a36Sopenharmony_ci	uint32_t value_1;
90462306a36Sopenharmony_ci	uint32_t value_2;
90562306a36Sopenharmony_ci	uint32_t value_3;
90662306a36Sopenharmony_ci};
90762306a36Sopenharmony_ci
90862306a36Sopenharmony_cistruct qla8xxx_minidump_entry_cache {
90962306a36Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
91062306a36Sopenharmony_ci	uint32_t tag_reg_addr;
91162306a36Sopenharmony_ci	struct {
91262306a36Sopenharmony_ci		uint16_t tag_value_stride;
91362306a36Sopenharmony_ci		uint16_t init_tag_value;
91462306a36Sopenharmony_ci	} addr_ctrl;
91562306a36Sopenharmony_ci	uint32_t data_size;
91662306a36Sopenharmony_ci	uint32_t op_count;
91762306a36Sopenharmony_ci	uint32_t control_addr;
91862306a36Sopenharmony_ci	struct {
91962306a36Sopenharmony_ci		uint16_t write_value;
92062306a36Sopenharmony_ci		uint8_t poll_mask;
92162306a36Sopenharmony_ci		uint8_t poll_wait;
92262306a36Sopenharmony_ci	} cache_ctrl;
92362306a36Sopenharmony_ci	uint32_t read_addr;
92462306a36Sopenharmony_ci	struct {
92562306a36Sopenharmony_ci		uint8_t read_addr_stride;
92662306a36Sopenharmony_ci		uint8_t read_addr_cnt;
92762306a36Sopenharmony_ci		uint16_t rsvd_1;
92862306a36Sopenharmony_ci	} read_ctrl;
92962306a36Sopenharmony_ci};
93062306a36Sopenharmony_ci
93162306a36Sopenharmony_ci/* Read OCM */
93262306a36Sopenharmony_cistruct qla8xxx_minidump_entry_rdocm {
93362306a36Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
93462306a36Sopenharmony_ci	uint32_t rsvd_0;
93562306a36Sopenharmony_ci	uint32_t rsvd_1;
93662306a36Sopenharmony_ci	uint32_t data_size;
93762306a36Sopenharmony_ci	uint32_t op_count;
93862306a36Sopenharmony_ci	uint32_t rsvd_2;
93962306a36Sopenharmony_ci	uint32_t rsvd_3;
94062306a36Sopenharmony_ci	uint32_t read_addr;
94162306a36Sopenharmony_ci	uint32_t read_addr_stride;
94262306a36Sopenharmony_ci};
94362306a36Sopenharmony_ci
94462306a36Sopenharmony_ci/* Read Memory */
94562306a36Sopenharmony_cistruct qla8xxx_minidump_entry_rdmem {
94662306a36Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
94762306a36Sopenharmony_ci	uint32_t rsvd[6];
94862306a36Sopenharmony_ci	uint32_t read_addr;
94962306a36Sopenharmony_ci	uint32_t read_data_size;
95062306a36Sopenharmony_ci};
95162306a36Sopenharmony_ci
95262306a36Sopenharmony_ci/* Read ROM */
95362306a36Sopenharmony_cistruct qla8xxx_minidump_entry_rdrom {
95462306a36Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
95562306a36Sopenharmony_ci	uint32_t rsvd[6];
95662306a36Sopenharmony_ci	uint32_t read_addr;
95762306a36Sopenharmony_ci	uint32_t read_data_size;
95862306a36Sopenharmony_ci};
95962306a36Sopenharmony_ci
96062306a36Sopenharmony_ci/* Mux entry */
96162306a36Sopenharmony_cistruct qla8xxx_minidump_entry_mux {
96262306a36Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
96362306a36Sopenharmony_ci	uint32_t select_addr;
96462306a36Sopenharmony_ci	uint32_t rsvd_0;
96562306a36Sopenharmony_ci	uint32_t data_size;
96662306a36Sopenharmony_ci	uint32_t op_count;
96762306a36Sopenharmony_ci	uint32_t select_value;
96862306a36Sopenharmony_ci	uint32_t select_value_stride;
96962306a36Sopenharmony_ci	uint32_t read_addr;
97062306a36Sopenharmony_ci	uint32_t rsvd_1;
97162306a36Sopenharmony_ci};
97262306a36Sopenharmony_ci
97362306a36Sopenharmony_ci/* Queue entry */
97462306a36Sopenharmony_cistruct qla8xxx_minidump_entry_queue {
97562306a36Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
97662306a36Sopenharmony_ci	uint32_t select_addr;
97762306a36Sopenharmony_ci	struct {
97862306a36Sopenharmony_ci		uint16_t queue_id_stride;
97962306a36Sopenharmony_ci		uint16_t rsvd_0;
98062306a36Sopenharmony_ci	} q_strd;
98162306a36Sopenharmony_ci	uint32_t data_size;
98262306a36Sopenharmony_ci	uint32_t op_count;
98362306a36Sopenharmony_ci	uint32_t rsvd_1;
98462306a36Sopenharmony_ci	uint32_t rsvd_2;
98562306a36Sopenharmony_ci	uint32_t read_addr;
98662306a36Sopenharmony_ci	struct {
98762306a36Sopenharmony_ci		uint8_t read_addr_stride;
98862306a36Sopenharmony_ci		uint8_t read_addr_cnt;
98962306a36Sopenharmony_ci		uint16_t rsvd_3;
99062306a36Sopenharmony_ci	} rd_strd;
99162306a36Sopenharmony_ci};
99262306a36Sopenharmony_ci
99362306a36Sopenharmony_ci#define MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE	0x129
99462306a36Sopenharmony_ci#define RQST_TMPLT_SIZE				0x0
99562306a36Sopenharmony_ci#define RQST_TMPLT				0x1
99662306a36Sopenharmony_ci#define MD_DIRECT_ROM_WINDOW			0x42110030
99762306a36Sopenharmony_ci#define MD_DIRECT_ROM_READ_BASE			0x42150000
99862306a36Sopenharmony_ci#define MD_MIU_TEST_AGT_CTRL			0x41000090
99962306a36Sopenharmony_ci#define MD_MIU_TEST_AGT_ADDR_LO			0x41000094
100062306a36Sopenharmony_ci#define MD_MIU_TEST_AGT_ADDR_HI			0x41000098
100162306a36Sopenharmony_ci
100262306a36Sopenharmony_ci#define MD_MIU_TEST_AGT_WRDATA_LO		0x410000A0
100362306a36Sopenharmony_ci#define MD_MIU_TEST_AGT_WRDATA_HI		0x410000A4
100462306a36Sopenharmony_ci#define MD_MIU_TEST_AGT_WRDATA_ULO		0x410000B0
100562306a36Sopenharmony_ci#define MD_MIU_TEST_AGT_WRDATA_UHI		0x410000B4
100662306a36Sopenharmony_ci
100762306a36Sopenharmony_ci#endif
1008