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
78c2ecf20Sopenharmony_ci#ifndef __QL483XX_H
88c2ecf20Sopenharmony_ci#define __QL483XX_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* Indirectly Mapped Registers */
118c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_SPI_STATUS	0x2808E010
128c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_SPI_CONTROL	0x2808E014
138c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_STATUS		0x42100004
148c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_CONTROL		0x42110004
158c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_ADDR		0x42110008
168c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_WRDATA		0x4211000C
178c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_RDDATA		0x42110018
188c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_DIRECT_WINDOW	0x42110030
198c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_DIRECT_DATA(DATA) (0x42150000 | (0x0000FFFF&DATA))
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Directly Mapped Registers in 83xx register table */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* Flash access regs */
248c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_LOCK		0x3850
258c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_UNLOCK		0x3854
268c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_LOCK_ID		0x3500
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* Driver Lock regs */
298c2ecf20Sopenharmony_ci#define QLA83XX_DRV_LOCK		0x3868
308c2ecf20Sopenharmony_ci#define QLA83XX_DRV_UNLOCK		0x386C
318c2ecf20Sopenharmony_ci#define QLA83XX_DRV_LOCK_ID		0x3504
328c2ecf20Sopenharmony_ci#define QLA83XX_DRV_LOCKRECOVERY	0x379C
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* IDC version */
358c2ecf20Sopenharmony_ci#define QLA83XX_IDC_VER_MAJ_VALUE       0x1
368c2ecf20Sopenharmony_ci#define QLA83XX_IDC_VER_MIN_VALUE       0x0
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* IDC Registers : Driver Coexistence Defines */
398c2ecf20Sopenharmony_ci#define QLA83XX_CRB_IDC_VER_MAJOR	0x3780
408c2ecf20Sopenharmony_ci#define QLA83XX_CRB_IDC_VER_MINOR	0x3798
418c2ecf20Sopenharmony_ci#define QLA83XX_IDC_DRV_CTRL		0x3790
428c2ecf20Sopenharmony_ci#define QLA83XX_IDC_DRV_AUDIT		0x3794
438c2ecf20Sopenharmony_ci#define QLA83XX_SRE_SHIM_CONTROL	0x0D200284
448c2ecf20Sopenharmony_ci#define QLA83XX_PORT0_RXB_PAUSE_THRS	0x0B2003A4
458c2ecf20Sopenharmony_ci#define QLA83XX_PORT1_RXB_PAUSE_THRS	0x0B2013A4
468c2ecf20Sopenharmony_ci#define QLA83XX_PORT0_RXB_TC_MAX_CELL	0x0B200388
478c2ecf20Sopenharmony_ci#define QLA83XX_PORT1_RXB_TC_MAX_CELL	0x0B201388
488c2ecf20Sopenharmony_ci#define QLA83XX_PORT0_RXB_TC_STATS	0x0B20039C
498c2ecf20Sopenharmony_ci#define QLA83XX_PORT1_RXB_TC_STATS	0x0B20139C
508c2ecf20Sopenharmony_ci#define QLA83XX_PORT2_IFB_PAUSE_THRS	0x0B200704
518c2ecf20Sopenharmony_ci#define QLA83XX_PORT3_IFB_PAUSE_THRS	0x0B201704
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/* set value to pause threshold value */
548c2ecf20Sopenharmony_ci#define QLA83XX_SET_PAUSE_VAL		0x0
558c2ecf20Sopenharmony_ci#define QLA83XX_SET_TC_MAX_CELL_VAL	0x03FF03FF
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define QLA83XX_RESET_CONTROL		0x28084E50
588c2ecf20Sopenharmony_ci#define QLA83XX_RESET_REG		0x28084E60
598c2ecf20Sopenharmony_ci#define QLA83XX_RESET_PORT0		0x28084E70
608c2ecf20Sopenharmony_ci#define QLA83XX_RESET_PORT1		0x28084E80
618c2ecf20Sopenharmony_ci#define QLA83XX_RESET_PORT2		0x28084E90
628c2ecf20Sopenharmony_ci#define QLA83XX_RESET_PORT3		0x28084EA0
638c2ecf20Sopenharmony_ci#define QLA83XX_RESET_SRE_SHIM		0x28084EB0
648c2ecf20Sopenharmony_ci#define QLA83XX_RESET_EPG_SHIM		0x28084EC0
658c2ecf20Sopenharmony_ci#define QLA83XX_RESET_ETHER_PCS		0x28084ED0
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/* qla_83xx_reg_tbl registers */
688c2ecf20Sopenharmony_ci#define QLA83XX_PEG_HALT_STATUS1	0x34A8
698c2ecf20Sopenharmony_ci#define QLA83XX_PEG_HALT_STATUS2	0x34AC
708c2ecf20Sopenharmony_ci#define QLA83XX_PEG_ALIVE_COUNTER	0x34B0 /* FW_HEARTBEAT */
718c2ecf20Sopenharmony_ci#define QLA83XX_FW_CAPABILITIES		0x3528
728c2ecf20Sopenharmony_ci#define QLA83XX_CRB_DRV_ACTIVE		0x3788 /* IDC_DRV_PRESENCE */
738c2ecf20Sopenharmony_ci#define QLA83XX_CRB_DEV_STATE		0x3784 /* IDC_DEV_STATE */
748c2ecf20Sopenharmony_ci#define QLA83XX_CRB_DRV_STATE		0x378C /* IDC_DRV_ACK */
758c2ecf20Sopenharmony_ci#define QLA83XX_CRB_DRV_SCRATCH		0x3548
768c2ecf20Sopenharmony_ci#define QLA83XX_CRB_DEV_PART_INFO1	0x37E0
778c2ecf20Sopenharmony_ci#define QLA83XX_CRB_DEV_PART_INFO2	0x37E4
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#define QLA83XX_FW_VER_MAJOR		0x3550
808c2ecf20Sopenharmony_ci#define QLA83XX_FW_VER_MINOR		0x3554
818c2ecf20Sopenharmony_ci#define QLA83XX_FW_VER_SUB		0x3558
828c2ecf20Sopenharmony_ci#define QLA83XX_NPAR_STATE		0x359C
838c2ecf20Sopenharmony_ci#define QLA83XX_FW_IMAGE_VALID		0x35FC
848c2ecf20Sopenharmony_ci#define QLA83XX_CMDPEG_STATE		0x3650
858c2ecf20Sopenharmony_ci#define QLA83XX_ASIC_TEMP		0x37B4
868c2ecf20Sopenharmony_ci#define QLA83XX_FW_API			0x356C
878c2ecf20Sopenharmony_ci#define QLA83XX_DRV_OP_MODE		0x3570
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#define QLA83XX_CRB_WIN_BASE		0x3800
908c2ecf20Sopenharmony_ci#define QLA83XX_CRB_WIN_FUNC(f)		(QLA83XX_CRB_WIN_BASE+((f)*4))
918c2ecf20Sopenharmony_ci#define QLA83XX_SEM_LOCK_BASE		0x3840
928c2ecf20Sopenharmony_ci#define QLA83XX_SEM_UNLOCK_BASE		0x3844
938c2ecf20Sopenharmony_ci#define QLA83XX_SEM_LOCK_FUNC(f)	(QLA83XX_SEM_LOCK_BASE+((f)*8))
948c2ecf20Sopenharmony_ci#define QLA83XX_SEM_UNLOCK_FUNC(f)	(QLA83XX_SEM_UNLOCK_BASE+((f)*8))
958c2ecf20Sopenharmony_ci#define QLA83XX_LINK_STATE(f)		(0x3698+((f) > 7 ? 4 : 0))
968c2ecf20Sopenharmony_ci#define QLA83XX_LINK_SPEED(f)		(0x36E0+(((f) >> 2) * 4))
978c2ecf20Sopenharmony_ci#define QLA83XX_MAX_LINK_SPEED(f)       (0x36F0+(((f) / 4) * 4))
988c2ecf20Sopenharmony_ci#define QLA83XX_LINK_SPEED_FACTOR	10
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci/* FLASH API Defines */
1018c2ecf20Sopenharmony_ci#define QLA83xx_FLASH_MAX_WAIT_USEC	100
1028c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_LOCK_TIMEOUT	10000
1038c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_SECTOR_SIZE	65536
1048c2ecf20Sopenharmony_ci#define QLA83XX_DRV_LOCK_TIMEOUT	2000
1058c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_SECTOR_ERASE_CMD	0xdeadbeef
1068c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_WRITE_CMD		0xdacdacda
1078c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_BUFFER_WRITE_CMD	0xcadcadca
1088c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_READ_RETRY_COUNT	2000
1098c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_STATUS_READY	0x6
1108c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_BUFFER_WRITE_MIN	2
1118c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_BUFFER_WRITE_MAX	64
1128c2ecf20Sopenharmony_ci#define QLA83XX_FLASH_STATUS_REG_POLL_DELAY 1
1138c2ecf20Sopenharmony_ci#define QLA83XX_ERASE_MODE		1
1148c2ecf20Sopenharmony_ci#define QLA83XX_WRITE_MODE		2
1158c2ecf20Sopenharmony_ci#define QLA83XX_DWORD_WRITE_MODE	3
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci#define QLA83XX_GLOBAL_RESET		0x38CC
1188c2ecf20Sopenharmony_ci#define QLA83XX_WILDCARD		0x38F0
1198c2ecf20Sopenharmony_ci#define QLA83XX_INFORMANT		0x38FC
1208c2ecf20Sopenharmony_ci#define QLA83XX_HOST_MBX_CTRL		0x3038
1218c2ecf20Sopenharmony_ci#define QLA83XX_FW_MBX_CTRL		0x303C
1228c2ecf20Sopenharmony_ci#define QLA83XX_BOOTLOADER_ADDR		0x355C
1238c2ecf20Sopenharmony_ci#define QLA83XX_BOOTLOADER_SIZE		0x3560
1248c2ecf20Sopenharmony_ci#define QLA83XX_FW_IMAGE_ADDR		0x3564
1258c2ecf20Sopenharmony_ci#define QLA83XX_MBX_INTR_ENABLE		0x1000
1268c2ecf20Sopenharmony_ci#define QLA83XX_MBX_INTR_MASK		0x1200
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci/* IDC Control Register bit defines */
1298c2ecf20Sopenharmony_ci#define DONTRESET_BIT0		0x1
1308c2ecf20Sopenharmony_ci#define GRACEFUL_RESET_BIT1	0x2
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci#define QLA83XX_HALT_STATUS_INFORMATIONAL	(0x1 << 29)
1338c2ecf20Sopenharmony_ci#define QLA83XX_HALT_STATUS_FW_RESET		(0x2 << 29)
1348c2ecf20Sopenharmony_ci#define QLA83XX_HALT_STATUS_UNRECOVERABLE	(0x4 << 29)
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci/* Firmware image definitions */
1378c2ecf20Sopenharmony_ci#define QLA83XX_BOOTLOADER_FLASH_ADDR	0x10000
1388c2ecf20Sopenharmony_ci#define QLA83XX_BOOT_FROM_FLASH		0
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#define QLA83XX_IDC_PARAM_ADDR		0x3e8020
1418c2ecf20Sopenharmony_ci/* Reset template definitions */
1428c2ecf20Sopenharmony_ci#define QLA83XX_MAX_RESET_SEQ_ENTRIES	16
1438c2ecf20Sopenharmony_ci#define QLA83XX_RESTART_TEMPLATE_SIZE	0x2000
1448c2ecf20Sopenharmony_ci#define QLA83XX_RESET_TEMPLATE_ADDR	0x4F0000
1458c2ecf20Sopenharmony_ci#define QLA83XX_RESET_SEQ_VERSION	0x0101
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci/* Reset template entry opcodes */
1488c2ecf20Sopenharmony_ci#define OPCODE_NOP			0x0000
1498c2ecf20Sopenharmony_ci#define OPCODE_WRITE_LIST		0x0001
1508c2ecf20Sopenharmony_ci#define OPCODE_READ_WRITE_LIST		0x0002
1518c2ecf20Sopenharmony_ci#define OPCODE_POLL_LIST		0x0004
1528c2ecf20Sopenharmony_ci#define OPCODE_POLL_WRITE_LIST		0x0008
1538c2ecf20Sopenharmony_ci#define OPCODE_READ_MODIFY_WRITE	0x0010
1548c2ecf20Sopenharmony_ci#define OPCODE_SEQ_PAUSE		0x0020
1558c2ecf20Sopenharmony_ci#define OPCODE_SEQ_END			0x0040
1568c2ecf20Sopenharmony_ci#define OPCODE_TMPL_END			0x0080
1578c2ecf20Sopenharmony_ci#define OPCODE_POLL_READ_LIST		0x0100
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/* Template Header */
1608c2ecf20Sopenharmony_ci#define RESET_TMPLT_HDR_SIGNATURE	0xCAFE
1618c2ecf20Sopenharmony_cistruct qla4_83xx_reset_template_hdr {
1628c2ecf20Sopenharmony_ci	__le16	version;
1638c2ecf20Sopenharmony_ci	__le16	signature;
1648c2ecf20Sopenharmony_ci	__le16	size;
1658c2ecf20Sopenharmony_ci	__le16	entries;
1668c2ecf20Sopenharmony_ci	__le16	hdr_size;
1678c2ecf20Sopenharmony_ci	__le16	checksum;
1688c2ecf20Sopenharmony_ci	__le16	init_seq_offset;
1698c2ecf20Sopenharmony_ci	__le16	start_seq_offset;
1708c2ecf20Sopenharmony_ci} __packed;
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci/* Common Entry Header. */
1738c2ecf20Sopenharmony_cistruct qla4_83xx_reset_entry_hdr {
1748c2ecf20Sopenharmony_ci	__le16 cmd;
1758c2ecf20Sopenharmony_ci	__le16 size;
1768c2ecf20Sopenharmony_ci	__le16 count;
1778c2ecf20Sopenharmony_ci	__le16 delay;
1788c2ecf20Sopenharmony_ci} __packed;
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci/* Generic poll entry type. */
1818c2ecf20Sopenharmony_cistruct qla4_83xx_poll {
1828c2ecf20Sopenharmony_ci	__le32  test_mask;
1838c2ecf20Sopenharmony_ci	__le32  test_value;
1848c2ecf20Sopenharmony_ci} __packed;
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci/* Read modify write entry type. */
1878c2ecf20Sopenharmony_cistruct qla4_83xx_rmw {
1888c2ecf20Sopenharmony_ci	__le32  test_mask;
1898c2ecf20Sopenharmony_ci	__le32  xor_value;
1908c2ecf20Sopenharmony_ci	__le32  or_value;
1918c2ecf20Sopenharmony_ci	uint8_t shl;
1928c2ecf20Sopenharmony_ci	uint8_t shr;
1938c2ecf20Sopenharmony_ci	uint8_t index_a;
1948c2ecf20Sopenharmony_ci	uint8_t rsvd;
1958c2ecf20Sopenharmony_ci} __packed;
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci/* Generic Entry Item with 2 DWords. */
1988c2ecf20Sopenharmony_cistruct qla4_83xx_entry {
1998c2ecf20Sopenharmony_ci	__le32 arg1;
2008c2ecf20Sopenharmony_ci	__le32 arg2;
2018c2ecf20Sopenharmony_ci} __packed;
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/* Generic Entry Item with 4 DWords.*/
2048c2ecf20Sopenharmony_cistruct qla4_83xx_quad_entry {
2058c2ecf20Sopenharmony_ci	__le32 dr_addr;
2068c2ecf20Sopenharmony_ci	__le32 dr_value;
2078c2ecf20Sopenharmony_ci	__le32 ar_addr;
2088c2ecf20Sopenharmony_ci	__le32 ar_value;
2098c2ecf20Sopenharmony_ci} __packed;
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_cistruct qla4_83xx_reset_template {
2128c2ecf20Sopenharmony_ci	int seq_index;
2138c2ecf20Sopenharmony_ci	int seq_error;
2148c2ecf20Sopenharmony_ci	int array_index;
2158c2ecf20Sopenharmony_ci	uint32_t array[QLA83XX_MAX_RESET_SEQ_ENTRIES];
2168c2ecf20Sopenharmony_ci	uint8_t *buff;
2178c2ecf20Sopenharmony_ci	uint8_t *stop_offset;
2188c2ecf20Sopenharmony_ci	uint8_t *start_offset;
2198c2ecf20Sopenharmony_ci	uint8_t *init_offset;
2208c2ecf20Sopenharmony_ci	struct qla4_83xx_reset_template_hdr *hdr;
2218c2ecf20Sopenharmony_ci	uint8_t seq_end;
2228c2ecf20Sopenharmony_ci	uint8_t template_end;
2238c2ecf20Sopenharmony_ci};
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci/* POLLRD Entry */
2268c2ecf20Sopenharmony_cistruct qla83xx_minidump_entry_pollrd {
2278c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
2288c2ecf20Sopenharmony_ci	uint32_t select_addr;
2298c2ecf20Sopenharmony_ci	uint32_t read_addr;
2308c2ecf20Sopenharmony_ci	uint32_t select_value;
2318c2ecf20Sopenharmony_ci	uint16_t select_value_stride;
2328c2ecf20Sopenharmony_ci	uint16_t op_count;
2338c2ecf20Sopenharmony_ci	uint32_t poll_wait;
2348c2ecf20Sopenharmony_ci	uint32_t poll_mask;
2358c2ecf20Sopenharmony_ci	uint32_t data_size;
2368c2ecf20Sopenharmony_ci	uint32_t rsvd_1;
2378c2ecf20Sopenharmony_ci};
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_cistruct qla8044_minidump_entry_rddfe {
2408c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
2418c2ecf20Sopenharmony_ci	uint32_t addr_1;
2428c2ecf20Sopenharmony_ci	uint32_t value;
2438c2ecf20Sopenharmony_ci	uint8_t stride;
2448c2ecf20Sopenharmony_ci	uint8_t stride2;
2458c2ecf20Sopenharmony_ci	uint16_t count;
2468c2ecf20Sopenharmony_ci	uint32_t poll;
2478c2ecf20Sopenharmony_ci	uint32_t mask;
2488c2ecf20Sopenharmony_ci	uint32_t modify_mask;
2498c2ecf20Sopenharmony_ci	uint32_t data_size;
2508c2ecf20Sopenharmony_ci	uint32_t rsvd;
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci} __packed;
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_cistruct qla8044_minidump_entry_rdmdio {
2558c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	uint32_t addr_1;
2588c2ecf20Sopenharmony_ci	uint32_t addr_2;
2598c2ecf20Sopenharmony_ci	uint32_t value_1;
2608c2ecf20Sopenharmony_ci	uint8_t stride_1;
2618c2ecf20Sopenharmony_ci	uint8_t stride_2;
2628c2ecf20Sopenharmony_ci	uint16_t count;
2638c2ecf20Sopenharmony_ci	uint32_t poll;
2648c2ecf20Sopenharmony_ci	uint32_t mask;
2658c2ecf20Sopenharmony_ci	uint32_t value_2;
2668c2ecf20Sopenharmony_ci	uint32_t data_size;
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci} __packed;
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_cistruct qla8044_minidump_entry_pollwr {
2718c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
2728c2ecf20Sopenharmony_ci	uint32_t addr_1;
2738c2ecf20Sopenharmony_ci	uint32_t addr_2;
2748c2ecf20Sopenharmony_ci	uint32_t value_1;
2758c2ecf20Sopenharmony_ci	uint32_t value_2;
2768c2ecf20Sopenharmony_ci	uint32_t poll;
2778c2ecf20Sopenharmony_ci	uint32_t mask;
2788c2ecf20Sopenharmony_ci	uint32_t data_size;
2798c2ecf20Sopenharmony_ci	uint32_t rsvd;
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci} __packed;
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci/* RDMUX2 Entry */
2848c2ecf20Sopenharmony_cistruct qla83xx_minidump_entry_rdmux2 {
2858c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
2868c2ecf20Sopenharmony_ci	uint32_t select_addr_1;
2878c2ecf20Sopenharmony_ci	uint32_t select_addr_2;
2888c2ecf20Sopenharmony_ci	uint32_t select_value_1;
2898c2ecf20Sopenharmony_ci	uint32_t select_value_2;
2908c2ecf20Sopenharmony_ci	uint32_t op_count;
2918c2ecf20Sopenharmony_ci	uint32_t select_value_mask;
2928c2ecf20Sopenharmony_ci	uint32_t read_addr;
2938c2ecf20Sopenharmony_ci	uint8_t select_value_stride;
2948c2ecf20Sopenharmony_ci	uint8_t data_size;
2958c2ecf20Sopenharmony_ci	uint8_t rsvd[2];
2968c2ecf20Sopenharmony_ci};
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci/* POLLRDMWR Entry */
2998c2ecf20Sopenharmony_cistruct qla83xx_minidump_entry_pollrdmwr {
3008c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
3018c2ecf20Sopenharmony_ci	uint32_t addr_1;
3028c2ecf20Sopenharmony_ci	uint32_t addr_2;
3038c2ecf20Sopenharmony_ci	uint32_t value_1;
3048c2ecf20Sopenharmony_ci	uint32_t value_2;
3058c2ecf20Sopenharmony_ci	uint32_t poll_wait;
3068c2ecf20Sopenharmony_ci	uint32_t poll_mask;
3078c2ecf20Sopenharmony_ci	uint32_t modify_mask;
3088c2ecf20Sopenharmony_ci	uint32_t data_size;
3098c2ecf20Sopenharmony_ci};
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci/* IDC additional information */
3128c2ecf20Sopenharmony_cistruct qla4_83xx_idc_information {
3138c2ecf20Sopenharmony_ci	uint32_t request_desc;  /* IDC request descriptor */
3148c2ecf20Sopenharmony_ci	uint32_t info1; /* IDC additional info */
3158c2ecf20Sopenharmony_ci	uint32_t info2; /* IDC additional info */
3168c2ecf20Sopenharmony_ci	uint32_t info3; /* IDC additional info */
3178c2ecf20Sopenharmony_ci};
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci#define QLA83XX_PEX_DMA_ENGINE_INDEX		8
3208c2ecf20Sopenharmony_ci#define QLA83XX_PEX_DMA_BASE_ADDRESS		0x77320000
3218c2ecf20Sopenharmony_ci#define QLA83XX_PEX_DMA_NUM_OFFSET		0x10000
3228c2ecf20Sopenharmony_ci#define QLA83XX_PEX_DMA_CMD_ADDR_LOW		0x0
3238c2ecf20Sopenharmony_ci#define QLA83XX_PEX_DMA_CMD_ADDR_HIGH		0x04
3248c2ecf20Sopenharmony_ci#define QLA83XX_PEX_DMA_CMD_STS_AND_CNTRL	0x08
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci#define QLA83XX_PEX_DMA_READ_SIZE	(16 * 1024)
3278c2ecf20Sopenharmony_ci#define QLA83XX_PEX_DMA_MAX_WAIT	(100 * 100) /* Max wait of 100 msecs */
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci/* Read Memory: For Pex-DMA */
3308c2ecf20Sopenharmony_cistruct qla4_83xx_minidump_entry_rdmem_pex_dma {
3318c2ecf20Sopenharmony_ci	struct qla8xxx_minidump_entry_hdr h;
3328c2ecf20Sopenharmony_ci	uint32_t desc_card_addr;
3338c2ecf20Sopenharmony_ci	uint16_t dma_desc_cmd;
3348c2ecf20Sopenharmony_ci	uint8_t rsvd[2];
3358c2ecf20Sopenharmony_ci	uint32_t start_dma_cmd;
3368c2ecf20Sopenharmony_ci	uint8_t rsvd2[12];
3378c2ecf20Sopenharmony_ci	uint32_t read_addr;
3388c2ecf20Sopenharmony_ci	uint32_t read_data_size;
3398c2ecf20Sopenharmony_ci};
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_cistruct qla4_83xx_pex_dma_descriptor {
3428c2ecf20Sopenharmony_ci	struct {
3438c2ecf20Sopenharmony_ci		uint32_t read_data_size; /* 0-23: size, 24-31: rsvd */
3448c2ecf20Sopenharmony_ci		uint8_t rsvd[2];
3458c2ecf20Sopenharmony_ci		uint16_t dma_desc_cmd;
3468c2ecf20Sopenharmony_ci	} cmd;
3478c2ecf20Sopenharmony_ci	uint64_t src_addr;
3488c2ecf20Sopenharmony_ci	uint64_t dma_bus_addr; /* 0-3: desc-cmd, 4-7: pci-func,
3498c2ecf20Sopenharmony_ci				* 8-15: desc-cmd */
3508c2ecf20Sopenharmony_ci	uint8_t rsvd[24];
3518c2ecf20Sopenharmony_ci} __packed;
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci#endif
354