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 _QLA4X_FW_H
88c2ecf20Sopenharmony_ci#define _QLA4X_FW_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define MAX_PRST_DEV_DB_ENTRIES		64
128c2ecf20Sopenharmony_ci#define MIN_DISC_DEV_DB_ENTRY		MAX_PRST_DEV_DB_ENTRIES
138c2ecf20Sopenharmony_ci#define MAX_DEV_DB_ENTRIES		512
148c2ecf20Sopenharmony_ci#define MAX_DEV_DB_ENTRIES_40XX		256
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*************************************************************************
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci *		ISP 4010 I/O Register Set Structure and Definitions
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci *************************************************************************/
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cistruct port_ctrl_stat_regs {
238c2ecf20Sopenharmony_ci	__le32 ext_hw_conf;	/* 0x50  R/W */
248c2ecf20Sopenharmony_ci	__le32 rsrvd0;		/* 0x54 */
258c2ecf20Sopenharmony_ci	__le32 port_ctrl;	/* 0x58 */
268c2ecf20Sopenharmony_ci	__le32 port_status;	/* 0x5c */
278c2ecf20Sopenharmony_ci	__le32 rsrvd1[32];	/* 0x60-0xdf */
288c2ecf20Sopenharmony_ci	__le32 gp_out;		/* 0xe0 */
298c2ecf20Sopenharmony_ci	__le32 gp_in;		/* 0xe4 */
308c2ecf20Sopenharmony_ci	__le32 rsrvd2[5];	/* 0xe8-0xfb */
318c2ecf20Sopenharmony_ci	__le32 port_err_status; /* 0xfc */
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistruct host_mem_cfg_regs {
358c2ecf20Sopenharmony_ci	__le32 rsrvd0[12];	/* 0x50-0x79 */
368c2ecf20Sopenharmony_ci	__le32 req_q_out;	/* 0x80 */
378c2ecf20Sopenharmony_ci	__le32 rsrvd1[31];	/* 0x84-0xFF */
388c2ecf20Sopenharmony_ci};
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/*
418c2ecf20Sopenharmony_ci * ISP 82xx I/O Register Set structure definitions.
428c2ecf20Sopenharmony_ci */
438c2ecf20Sopenharmony_cistruct device_reg_82xx {
448c2ecf20Sopenharmony_ci	__le32 req_q_out;	/* 0x0000 (R): Request Queue out-Pointer. */
458c2ecf20Sopenharmony_ci	__le32 reserve1[63];	/* Request Queue out-Pointer. (64 * 4) */
468c2ecf20Sopenharmony_ci	__le32 rsp_q_in;	/* 0x0100 (R/W): Response Queue In-Pointer. */
478c2ecf20Sopenharmony_ci	__le32 reserve2[63];	/* Response Queue In-Pointer. */
488c2ecf20Sopenharmony_ci	__le32 rsp_q_out;	/* 0x0200 (R/W): Response Queue Out-Pointer. */
498c2ecf20Sopenharmony_ci	__le32 reserve3[63];	/* Response Queue Out-Pointer. */
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	__le32 mailbox_in[8];	/* 0x0300 (R/W): Mail box In registers */
528c2ecf20Sopenharmony_ci	__le32 reserve4[24];
538c2ecf20Sopenharmony_ci	__le32 hint;		/* 0x0380 (R/W): Host interrupt register */
548c2ecf20Sopenharmony_ci#define HINT_MBX_INT_PENDING	BIT_0
558c2ecf20Sopenharmony_ci	__le32 reserve5[31];
568c2ecf20Sopenharmony_ci	__le32 mailbox_out[8];	/* 0x0400 (R): Mail box Out registers */
578c2ecf20Sopenharmony_ci	__le32 reserve6[56];
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	__le32 host_status;	/* Offset 0x500 (R): host status */
608c2ecf20Sopenharmony_ci#define HSRX_RISC_MB_INT	BIT_0  /* RISC to Host Mailbox interrupt */
618c2ecf20Sopenharmony_ci#define HSRX_RISC_IOCB_INT	BIT_1  /* RISC to Host IOCB interrupt */
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	__le32 host_int;	/* Offset 0x0504 (R/W): Interrupt status. */
648c2ecf20Sopenharmony_ci#define ISRX_82XX_RISC_INT	BIT_0 /* RISC interrupt. */
658c2ecf20Sopenharmony_ci};
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/* ISP 83xx I/O Register Set structure */
688c2ecf20Sopenharmony_cistruct device_reg_83xx {
698c2ecf20Sopenharmony_ci	__le32 mailbox_in[16];	/* 0x0000 */
708c2ecf20Sopenharmony_ci	__le32 reserve1[496];	/* 0x0040 */
718c2ecf20Sopenharmony_ci	__le32 mailbox_out[16];	/* 0x0800 */
728c2ecf20Sopenharmony_ci	__le32 reserve2[496];
738c2ecf20Sopenharmony_ci	__le32 mbox_int;	/* 0x1000 */
748c2ecf20Sopenharmony_ci	__le32 reserve3[63];
758c2ecf20Sopenharmony_ci	__le32 req_q_out;	/* 0x1100 */
768c2ecf20Sopenharmony_ci	__le32 reserve4[63];
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci	__le32 rsp_q_in;	/* 0x1200 */
798c2ecf20Sopenharmony_ci	__le32 reserve5[1919];
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci	__le32 req_q_in;	/* 0x3000 */
828c2ecf20Sopenharmony_ci	__le32 reserve6[3];
838c2ecf20Sopenharmony_ci	__le32 iocb_int_mask;	/* 0x3010 */
848c2ecf20Sopenharmony_ci	__le32 reserve7[3];
858c2ecf20Sopenharmony_ci	__le32 rsp_q_out;	/* 0x3020 */
868c2ecf20Sopenharmony_ci	__le32 reserve8[3];
878c2ecf20Sopenharmony_ci	__le32 anonymousbuff;	/* 0x3030 */
888c2ecf20Sopenharmony_ci	__le32 mb_int_mask;	/* 0x3034 */
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci	__le32 host_intr;	/* 0x3038 - Host Interrupt Register */
918c2ecf20Sopenharmony_ci	__le32 risc_intr;	/* 0x303C - RISC Interrupt Register */
928c2ecf20Sopenharmony_ci	__le32 reserve9[544];
938c2ecf20Sopenharmony_ci	__le32 leg_int_ptr;	/* 0x38C0 - Legacy Interrupt Pointer Register */
948c2ecf20Sopenharmony_ci	__le32 leg_int_trig;	/* 0x38C4 - Legacy Interrupt Trigger Control */
958c2ecf20Sopenharmony_ci	__le32 leg_int_mask;	/* 0x38C8 - Legacy Interrupt Mask Register */
968c2ecf20Sopenharmony_ci};
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define INT_ENABLE_FW_MB	(1 << 2)
998c2ecf20Sopenharmony_ci#define INT_MASK_FW_MB		(1 << 2)
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/*  remote register set (access via PCI memory read/write) */
1028c2ecf20Sopenharmony_cistruct isp_reg {
1038c2ecf20Sopenharmony_ci#define MBOX_REG_COUNT 8
1048c2ecf20Sopenharmony_ci	__le32 mailbox[MBOX_REG_COUNT];
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci	__le32 flash_address;	/* 0x20 */
1078c2ecf20Sopenharmony_ci	__le32 flash_data;
1088c2ecf20Sopenharmony_ci	__le32 ctrl_status;
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci	union {
1118c2ecf20Sopenharmony_ci		struct {
1128c2ecf20Sopenharmony_ci			__le32 nvram;
1138c2ecf20Sopenharmony_ci			__le32 reserved1[2]; /* 0x30 */
1148c2ecf20Sopenharmony_ci		} __attribute__ ((packed)) isp4010;
1158c2ecf20Sopenharmony_ci		struct {
1168c2ecf20Sopenharmony_ci			__le32 intr_mask;
1178c2ecf20Sopenharmony_ci			__le32 nvram; /* 0x30 */
1188c2ecf20Sopenharmony_ci			__le32 semaphore;
1198c2ecf20Sopenharmony_ci		} __attribute__ ((packed)) isp4022;
1208c2ecf20Sopenharmony_ci	} u1;
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci	__le32 req_q_in;    /* SCSI Request Queue Producer Index */
1238c2ecf20Sopenharmony_ci	__le32 rsp_q_out;   /* SCSI Completion Queue Consumer Index */
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci	__le32 reserved2[4];	/* 0x40 */
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci	union {
1288c2ecf20Sopenharmony_ci		struct {
1298c2ecf20Sopenharmony_ci			__le32 ext_hw_conf; /* 0x50 */
1308c2ecf20Sopenharmony_ci			__le32 flow_ctrl;
1318c2ecf20Sopenharmony_ci			__le32 port_ctrl;
1328c2ecf20Sopenharmony_ci			__le32 port_status;
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci			__le32 reserved3[8]; /* 0x60 */
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci			__le32 req_q_out; /* 0x80 */
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci			__le32 reserved4[23]; /* 0x84 */
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci			__le32 gp_out; /* 0xe0 */
1418c2ecf20Sopenharmony_ci			__le32 gp_in;
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci			__le32 reserved5[5];
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci			__le32 port_err_status; /* 0xfc */
1468c2ecf20Sopenharmony_ci		} __attribute__ ((packed)) isp4010;
1478c2ecf20Sopenharmony_ci		struct {
1488c2ecf20Sopenharmony_ci			union {
1498c2ecf20Sopenharmony_ci				struct port_ctrl_stat_regs p0;
1508c2ecf20Sopenharmony_ci				struct host_mem_cfg_regs p1;
1518c2ecf20Sopenharmony_ci			};
1528c2ecf20Sopenharmony_ci		} __attribute__ ((packed)) isp4022;
1538c2ecf20Sopenharmony_ci	} u2;
1548c2ecf20Sopenharmony_ci};				/* 256 x100 */
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/* Semaphore Defines for 4010 */
1588c2ecf20Sopenharmony_ci#define QL4010_DRVR_SEM_BITS	0x00000030
1598c2ecf20Sopenharmony_ci#define QL4010_GPIO_SEM_BITS	0x000000c0
1608c2ecf20Sopenharmony_ci#define QL4010_SDRAM_SEM_BITS	0x00000300
1618c2ecf20Sopenharmony_ci#define QL4010_PHY_SEM_BITS	0x00000c00
1628c2ecf20Sopenharmony_ci#define QL4010_NVRAM_SEM_BITS	0x00003000
1638c2ecf20Sopenharmony_ci#define QL4010_FLASH_SEM_BITS	0x0000c000
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci#define QL4010_DRVR_SEM_MASK	0x00300000
1668c2ecf20Sopenharmony_ci#define QL4010_GPIO_SEM_MASK	0x00c00000
1678c2ecf20Sopenharmony_ci#define QL4010_SDRAM_SEM_MASK	0x03000000
1688c2ecf20Sopenharmony_ci#define QL4010_PHY_SEM_MASK	0x0c000000
1698c2ecf20Sopenharmony_ci#define QL4010_NVRAM_SEM_MASK	0x30000000
1708c2ecf20Sopenharmony_ci#define QL4010_FLASH_SEM_MASK	0xc0000000
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci/* Semaphore Defines for 4022 */
1738c2ecf20Sopenharmony_ci#define QL4022_RESOURCE_MASK_BASE_CODE 0x7
1748c2ecf20Sopenharmony_ci#define QL4022_RESOURCE_BITS_BASE_CODE 0x4
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci#define QL4022_DRVR_SEM_MASK	(QL4022_RESOURCE_MASK_BASE_CODE << (1+16))
1788c2ecf20Sopenharmony_ci#define QL4022_DDR_RAM_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (4+16))
1798c2ecf20Sopenharmony_ci#define QL4022_PHY_GIO_SEM_MASK (QL4022_RESOURCE_MASK_BASE_CODE << (7+16))
1808c2ecf20Sopenharmony_ci#define QL4022_NVRAM_SEM_MASK	(QL4022_RESOURCE_MASK_BASE_CODE << (10+16))
1818c2ecf20Sopenharmony_ci#define QL4022_FLASH_SEM_MASK	(QL4022_RESOURCE_MASK_BASE_CODE << (13+16))
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* nvram address for 4032 */
1848c2ecf20Sopenharmony_ci#define NVRAM_PORT0_BOOT_MODE		0x03b1
1858c2ecf20Sopenharmony_ci#define NVRAM_PORT0_BOOT_PRI_TGT	0x03b2
1868c2ecf20Sopenharmony_ci#define NVRAM_PORT0_BOOT_SEC_TGT	0x03bb
1878c2ecf20Sopenharmony_ci#define NVRAM_PORT1_BOOT_MODE		0x07b1
1888c2ecf20Sopenharmony_ci#define NVRAM_PORT1_BOOT_PRI_TGT	0x07b2
1898c2ecf20Sopenharmony_ci#define NVRAM_PORT1_BOOT_SEC_TGT	0x07bb
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/* Page # defines for 4022 */
1938c2ecf20Sopenharmony_ci#define PORT_CTRL_STAT_PAGE			0	/* 4022 */
1948c2ecf20Sopenharmony_ci#define HOST_MEM_CFG_PAGE			1	/* 4022 */
1958c2ecf20Sopenharmony_ci#define LOCAL_RAM_CFG_PAGE			2	/* 4022 */
1968c2ecf20Sopenharmony_ci#define PROT_STAT_PAGE				3	/* 4022 */
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci/* Register Mask - sets corresponding mask bits in the upper word */
1998c2ecf20Sopenharmony_cistatic inline uint32_t set_rmask(uint32_t val)
2008c2ecf20Sopenharmony_ci{
2018c2ecf20Sopenharmony_ci	return (val & 0xffff) | (val << 16);
2028c2ecf20Sopenharmony_ci}
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_cistatic inline uint32_t clr_rmask(uint32_t val)
2068c2ecf20Sopenharmony_ci{
2078c2ecf20Sopenharmony_ci	return 0 | (val << 16);
2088c2ecf20Sopenharmony_ci}
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci/*  ctrl_status definitions */
2118c2ecf20Sopenharmony_ci#define CSR_SCSI_PAGE_SELECT			0x00000003
2128c2ecf20Sopenharmony_ci#define CSR_SCSI_INTR_ENABLE			0x00000004	/* 4010 */
2138c2ecf20Sopenharmony_ci#define CSR_SCSI_RESET_INTR			0x00000008
2148c2ecf20Sopenharmony_ci#define CSR_SCSI_COMPLETION_INTR		0x00000010
2158c2ecf20Sopenharmony_ci#define CSR_SCSI_PROCESSOR_INTR			0x00000020
2168c2ecf20Sopenharmony_ci#define CSR_INTR_RISC				0x00000040
2178c2ecf20Sopenharmony_ci#define CSR_BOOT_ENABLE				0x00000080
2188c2ecf20Sopenharmony_ci#define CSR_NET_PAGE_SELECT			0x00000300	/* 4010 */
2198c2ecf20Sopenharmony_ci#define CSR_FUNC_NUM				0x00000700	/* 4022 */
2208c2ecf20Sopenharmony_ci#define CSR_NET_RESET_INTR			0x00000800	/* 4010 */
2218c2ecf20Sopenharmony_ci#define CSR_FORCE_SOFT_RESET			0x00002000	/* 4022 */
2228c2ecf20Sopenharmony_ci#define CSR_FATAL_ERROR				0x00004000
2238c2ecf20Sopenharmony_ci#define CSR_SOFT_RESET				0x00008000
2248c2ecf20Sopenharmony_ci#define ISP_CONTROL_FN_MASK			CSR_FUNC_NUM
2258c2ecf20Sopenharmony_ci#define ISP_CONTROL_FN0_SCSI			0x0500
2268c2ecf20Sopenharmony_ci#define ISP_CONTROL_FN1_SCSI			0x0700
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci#define INTR_PENDING				(CSR_SCSI_COMPLETION_INTR |\
2298c2ecf20Sopenharmony_ci						 CSR_SCSI_PROCESSOR_INTR |\
2308c2ecf20Sopenharmony_ci						 CSR_SCSI_RESET_INTR)
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci/* ISP InterruptMask definitions */
2338c2ecf20Sopenharmony_ci#define IMR_SCSI_INTR_ENABLE			0x00000004	/* 4022 */
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci/* ISP 4022 nvram definitions */
2368c2ecf20Sopenharmony_ci#define NVR_WRITE_ENABLE			0x00000010	/* 4022 */
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci#define QL4010_NVRAM_SIZE			0x200
2398c2ecf20Sopenharmony_ci#define QL40X2_NVRAM_SIZE			0x800
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci/*  ISP port_status definitions */
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci/*  ISP Semaphore definitions */
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci/*  ISP General Purpose Output definitions */
2468c2ecf20Sopenharmony_ci#define GPOR_TOPCAT_RESET			0x00000004
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/*  shadow registers (DMA'd from HA to system memory.  read only) */
2498c2ecf20Sopenharmony_cistruct shadow_regs {
2508c2ecf20Sopenharmony_ci	/* SCSI Request Queue Consumer Index */
2518c2ecf20Sopenharmony_ci	__le32 req_q_out;	/*  0 x0   R */
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci	/* SCSI Completion Queue Producer Index */
2548c2ecf20Sopenharmony_ci	__le32 rsp_q_in;	/*  4 x4   R */
2558c2ecf20Sopenharmony_ci};		  /*  8 x8 */
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci/*  External hardware configuration register */
2598c2ecf20Sopenharmony_ciunion external_hw_config_reg {
2608c2ecf20Sopenharmony_ci	struct {
2618c2ecf20Sopenharmony_ci		/* FIXME: Do we even need this?	 All values are
2628c2ecf20Sopenharmony_ci		 * referred to by 16 bit quantities.  Platform and
2638c2ecf20Sopenharmony_ci		 * endianess issues. */
2648c2ecf20Sopenharmony_ci		__le32 bReserved0:1;
2658c2ecf20Sopenharmony_ci		__le32 bSDRAMProtectionMethod:2;
2668c2ecf20Sopenharmony_ci		__le32 bSDRAMBanks:1;
2678c2ecf20Sopenharmony_ci		__le32 bSDRAMChipWidth:1;
2688c2ecf20Sopenharmony_ci		__le32 bSDRAMChipSize:2;
2698c2ecf20Sopenharmony_ci		__le32 bParityDisable:1;
2708c2ecf20Sopenharmony_ci		__le32 bExternalMemoryType:1;
2718c2ecf20Sopenharmony_ci		__le32 bFlashBIOSWriteEnable:1;
2728c2ecf20Sopenharmony_ci		__le32 bFlashUpperBankSelect:1;
2738c2ecf20Sopenharmony_ci		__le32 bWriteBurst:2;
2748c2ecf20Sopenharmony_ci		__le32 bReserved1:3;
2758c2ecf20Sopenharmony_ci		__le32 bMask:16;
2768c2ecf20Sopenharmony_ci	};
2778c2ecf20Sopenharmony_ci	uint32_t Asuint32_t;
2788c2ecf20Sopenharmony_ci};
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci/* 82XX Support  start */
2818c2ecf20Sopenharmony_ci/* 82xx Default FLT Addresses */
2828c2ecf20Sopenharmony_ci#define FA_FLASH_LAYOUT_ADDR_82		0xFC400
2838c2ecf20Sopenharmony_ci#define FA_FLASH_DESCR_ADDR_82		0xFC000
2848c2ecf20Sopenharmony_ci#define FA_BOOT_LOAD_ADDR_82		0x04000
2858c2ecf20Sopenharmony_ci#define FA_BOOT_CODE_ADDR_82		0x20000
2868c2ecf20Sopenharmony_ci#define FA_RISC_CODE_ADDR_82		0x40000
2878c2ecf20Sopenharmony_ci#define FA_GOLD_RISC_CODE_ADDR_82	0x80000
2888c2ecf20Sopenharmony_ci#define FA_FLASH_ISCSI_CHAP		0x540000
2898c2ecf20Sopenharmony_ci#define FA_FLASH_CHAP_SIZE		0xC0000
2908c2ecf20Sopenharmony_ci#define FA_FLASH_ISCSI_DDB		0x420000
2918c2ecf20Sopenharmony_ci#define FA_FLASH_DDB_SIZE		0x080000
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci/* Flash Description Table */
2948c2ecf20Sopenharmony_cistruct qla_fdt_layout {
2958c2ecf20Sopenharmony_ci	uint8_t sig[4];
2968c2ecf20Sopenharmony_ci	uint16_t version;
2978c2ecf20Sopenharmony_ci	uint16_t len;
2988c2ecf20Sopenharmony_ci	uint16_t checksum;
2998c2ecf20Sopenharmony_ci	uint8_t unused1[2];
3008c2ecf20Sopenharmony_ci	uint8_t model[16];
3018c2ecf20Sopenharmony_ci	uint16_t man_id;
3028c2ecf20Sopenharmony_ci	uint16_t id;
3038c2ecf20Sopenharmony_ci	uint8_t flags;
3048c2ecf20Sopenharmony_ci	uint8_t erase_cmd;
3058c2ecf20Sopenharmony_ci	uint8_t alt_erase_cmd;
3068c2ecf20Sopenharmony_ci	uint8_t wrt_enable_cmd;
3078c2ecf20Sopenharmony_ci	uint8_t wrt_enable_bits;
3088c2ecf20Sopenharmony_ci	uint8_t wrt_sts_reg_cmd;
3098c2ecf20Sopenharmony_ci	uint8_t unprotect_sec_cmd;
3108c2ecf20Sopenharmony_ci	uint8_t read_man_id_cmd;
3118c2ecf20Sopenharmony_ci	uint32_t block_size;
3128c2ecf20Sopenharmony_ci	uint32_t alt_block_size;
3138c2ecf20Sopenharmony_ci	uint32_t flash_size;
3148c2ecf20Sopenharmony_ci	uint32_t wrt_enable_data;
3158c2ecf20Sopenharmony_ci	uint8_t read_id_addr_len;
3168c2ecf20Sopenharmony_ci	uint8_t wrt_disable_bits;
3178c2ecf20Sopenharmony_ci	uint8_t read_dev_id_len;
3188c2ecf20Sopenharmony_ci	uint8_t chip_erase_cmd;
3198c2ecf20Sopenharmony_ci	uint16_t read_timeout;
3208c2ecf20Sopenharmony_ci	uint8_t protect_sec_cmd;
3218c2ecf20Sopenharmony_ci	uint8_t unused2[65];
3228c2ecf20Sopenharmony_ci};
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci/* Flash Layout Table */
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_cistruct qla_flt_location {
3278c2ecf20Sopenharmony_ci	uint8_t sig[4];
3288c2ecf20Sopenharmony_ci	uint16_t start_lo;
3298c2ecf20Sopenharmony_ci	uint16_t start_hi;
3308c2ecf20Sopenharmony_ci	uint8_t version;
3318c2ecf20Sopenharmony_ci	uint8_t unused[5];
3328c2ecf20Sopenharmony_ci	uint16_t checksum;
3338c2ecf20Sopenharmony_ci};
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_cistruct qla_flt_header {
3368c2ecf20Sopenharmony_ci	uint16_t version;
3378c2ecf20Sopenharmony_ci	uint16_t length;
3388c2ecf20Sopenharmony_ci	uint16_t checksum;
3398c2ecf20Sopenharmony_ci	uint16_t unused;
3408c2ecf20Sopenharmony_ci};
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci/* 82xx FLT Regions */
3438c2ecf20Sopenharmony_ci#define FLT_REG_FDT		0x1a
3448c2ecf20Sopenharmony_ci#define FLT_REG_FLT		0x1c
3458c2ecf20Sopenharmony_ci#define FLT_REG_BOOTLOAD_82	0x72
3468c2ecf20Sopenharmony_ci#define FLT_REG_FW_82		0x74
3478c2ecf20Sopenharmony_ci#define FLT_REG_FW_82_1		0x97
3488c2ecf20Sopenharmony_ci#define FLT_REG_GOLD_FW_82	0x75
3498c2ecf20Sopenharmony_ci#define FLT_REG_BOOT_CODE_82	0x78
3508c2ecf20Sopenharmony_ci#define FLT_REG_ISCSI_PARAM	0x65
3518c2ecf20Sopenharmony_ci#define FLT_REG_ISCSI_CHAP	0x63
3528c2ecf20Sopenharmony_ci#define FLT_REG_ISCSI_DDB	0x6A
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_cistruct qla_flt_region {
3558c2ecf20Sopenharmony_ci	uint32_t code;
3568c2ecf20Sopenharmony_ci	uint32_t size;
3578c2ecf20Sopenharmony_ci	uint32_t start;
3588c2ecf20Sopenharmony_ci	uint32_t end;
3598c2ecf20Sopenharmony_ci};
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci/*************************************************************************
3628c2ecf20Sopenharmony_ci *
3638c2ecf20Sopenharmony_ci *		Mailbox Commands Structures and Definitions
3648c2ecf20Sopenharmony_ci *
3658c2ecf20Sopenharmony_ci *************************************************************************/
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci/*  Mailbox command definitions */
3688c2ecf20Sopenharmony_ci#define MBOX_CMD_ABOUT_FW			0x0009
3698c2ecf20Sopenharmony_ci#define MBOX_CMD_PING				0x000B
3708c2ecf20Sopenharmony_ci#define PING_IPV6_PROTOCOL_ENABLE		0x1
3718c2ecf20Sopenharmony_ci#define PING_IPV6_LINKLOCAL_ADDR		0x4
3728c2ecf20Sopenharmony_ci#define PING_IPV6_ADDR0				0x8
3738c2ecf20Sopenharmony_ci#define PING_IPV6_ADDR1				0xC
3748c2ecf20Sopenharmony_ci#define MBOX_CMD_ENABLE_INTRS			0x0010
3758c2ecf20Sopenharmony_ci#define INTR_DISABLE				0
3768c2ecf20Sopenharmony_ci#define INTR_ENABLE				1
3778c2ecf20Sopenharmony_ci#define MBOX_CMD_STOP_FW			0x0014
3788c2ecf20Sopenharmony_ci#define MBOX_CMD_ABORT_TASK			0x0015
3798c2ecf20Sopenharmony_ci#define MBOX_CMD_LUN_RESET			0x0016
3808c2ecf20Sopenharmony_ci#define MBOX_CMD_TARGET_WARM_RESET		0x0017
3818c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_MANAGEMENT_DATA		0x001E
3828c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_FW_STATUS			0x001F
3838c2ecf20Sopenharmony_ci#define MBOX_CMD_SET_ISNS_SERVICE		0x0021
3848c2ecf20Sopenharmony_ci#define ISNS_DISABLE				0
3858c2ecf20Sopenharmony_ci#define ISNS_ENABLE				1
3868c2ecf20Sopenharmony_ci#define MBOX_CMD_COPY_FLASH			0x0024
3878c2ecf20Sopenharmony_ci#define MBOX_CMD_WRITE_FLASH			0x0025
3888c2ecf20Sopenharmony_ci#define MBOX_CMD_READ_FLASH			0x0026
3898c2ecf20Sopenharmony_ci#define MBOX_CMD_CLEAR_DATABASE_ENTRY		0x0031
3908c2ecf20Sopenharmony_ci#define MBOX_CMD_CONN_OPEN			0x0074
3918c2ecf20Sopenharmony_ci#define MBOX_CMD_CONN_CLOSE_SESS_LOGOUT		0x0056
3928c2ecf20Sopenharmony_ci#define DDB_NOT_LOGGED_IN			0x09
3938c2ecf20Sopenharmony_ci#define LOGOUT_OPTION_CLOSE_SESSION		0x0002
3948c2ecf20Sopenharmony_ci#define LOGOUT_OPTION_RELOGIN			0x0004
3958c2ecf20Sopenharmony_ci#define LOGOUT_OPTION_FREE_DDB			0x0008
3968c2ecf20Sopenharmony_ci#define MBOX_CMD_SET_PARAM			0x0059
3978c2ecf20Sopenharmony_ci#define SET_DRVR_VERSION			0x200
3988c2ecf20Sopenharmony_ci#define MAX_DRVR_VER_LEN			24
3998c2ecf20Sopenharmony_ci#define MBOX_CMD_EXECUTE_IOCB_A64		0x005A
4008c2ecf20Sopenharmony_ci#define MBOX_CMD_INITIALIZE_FIRMWARE		0x0060
4018c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_INIT_FW_CTRL_BLOCK		0x0061
4028c2ecf20Sopenharmony_ci#define MBOX_CMD_REQUEST_DATABASE_ENTRY		0x0062
4038c2ecf20Sopenharmony_ci#define MBOX_CMD_SET_DATABASE_ENTRY		0x0063
4048c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_DATABASE_ENTRY		0x0064
4058c2ecf20Sopenharmony_ci#define DDB_DS_UNASSIGNED			0x00
4068c2ecf20Sopenharmony_ci#define DDB_DS_NO_CONNECTION_ACTIVE		0x01
4078c2ecf20Sopenharmony_ci#define DDB_DS_DISCOVERY			0x02
4088c2ecf20Sopenharmony_ci#define DDB_DS_SESSION_ACTIVE			0x04
4098c2ecf20Sopenharmony_ci#define DDB_DS_SESSION_FAILED			0x06
4108c2ecf20Sopenharmony_ci#define DDB_DS_LOGIN_IN_PROCESS			0x07
4118c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_FW_STATE			0x0069
4128c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_INIT_FW_CTRL_BLOCK_DEFAULTS 0x006A
4138c2ecf20Sopenharmony_ci#define MBOX_CMD_DIAG_TEST			0x0075
4148c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_SYS_INFO			0x0078
4158c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_NVRAM			0x0078	/* For 40xx */
4168c2ecf20Sopenharmony_ci#define MBOX_CMD_SET_NVRAM			0x0079	/* For 40xx */
4178c2ecf20Sopenharmony_ci#define MBOX_CMD_RESTORE_FACTORY_DEFAULTS	0x0087
4188c2ecf20Sopenharmony_ci#define MBOX_CMD_SET_ACB			0x0088
4198c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_ACB			0x0089
4208c2ecf20Sopenharmony_ci#define MBOX_CMD_DISABLE_ACB			0x008A
4218c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_IPV6_NEIGHBOR_CACHE	0x008B
4228c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_IPV6_DEST_CACHE		0x008C
4238c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_IPV6_DEF_ROUTER_LIST	0x008D
4248c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_IPV6_LCL_PREFIX_LIST	0x008E
4258c2ecf20Sopenharmony_ci#define MBOX_CMD_SET_IPV6_NEIGHBOR_CACHE	0x0090
4268c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_IP_ADDR_STATE		0x0091
4278c2ecf20Sopenharmony_ci#define MBOX_CMD_SEND_IPV6_ROUTER_SOL		0x0092
4288c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_DB_ENTRY_CURRENT_IP_ADDR	0x0093
4298c2ecf20Sopenharmony_ci#define MBOX_CMD_SET_PORT_CONFIG		0x0122
4308c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_PORT_CONFIG		0x0123
4318c2ecf20Sopenharmony_ci#define MBOX_CMD_SET_LED_CONFIG			0x0125
4328c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_LED_CONFIG			0x0126
4338c2ecf20Sopenharmony_ci#define MBOX_CMD_MINIDUMP			0x0129
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci/* Port Config */
4368c2ecf20Sopenharmony_ci#define ENABLE_INTERNAL_LOOPBACK		0x04
4378c2ecf20Sopenharmony_ci#define ENABLE_EXTERNAL_LOOPBACK		0x08
4388c2ecf20Sopenharmony_ci#define ENABLE_DCBX				0x10
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_ci/* Minidump subcommand */
4418c2ecf20Sopenharmony_ci#define MINIDUMP_GET_SIZE_SUBCOMMAND		0x00
4428c2ecf20Sopenharmony_ci#define MINIDUMP_GET_TMPLT_SUBCOMMAND		0x01
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci/* Mailbox 1 */
4458c2ecf20Sopenharmony_ci#define FW_STATE_READY				0x0000
4468c2ecf20Sopenharmony_ci#define FW_STATE_CONFIG_WAIT			0x0001
4478c2ecf20Sopenharmony_ci#define FW_STATE_WAIT_AUTOCONNECT		0x0002
4488c2ecf20Sopenharmony_ci#define FW_STATE_ERROR				0x0004
4498c2ecf20Sopenharmony_ci#define FW_STATE_CONFIGURING_IP			0x0008
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci/* Mailbox 3 */
4528c2ecf20Sopenharmony_ci#define FW_ADDSTATE_OPTICAL_MEDIA		0x0001
4538c2ecf20Sopenharmony_ci#define FW_ADDSTATE_DHCPv4_ENABLED		0x0002
4548c2ecf20Sopenharmony_ci#define FW_ADDSTATE_DHCPv4_LEASE_ACQUIRED	0x0004
4558c2ecf20Sopenharmony_ci#define FW_ADDSTATE_DHCPv4_LEASE_EXPIRED	0x0008
4568c2ecf20Sopenharmony_ci#define FW_ADDSTATE_LINK_UP			0x0010
4578c2ecf20Sopenharmony_ci#define FW_ADDSTATE_ISNS_SVC_ENABLED		0x0020
4588c2ecf20Sopenharmony_ci#define FW_ADDSTATE_LINK_SPEED_10MBPS		0x0100
4598c2ecf20Sopenharmony_ci#define FW_ADDSTATE_LINK_SPEED_100MBPS		0x0200
4608c2ecf20Sopenharmony_ci#define FW_ADDSTATE_LINK_SPEED_1GBPS		0x0400
4618c2ecf20Sopenharmony_ci#define FW_ADDSTATE_LINK_SPEED_10GBPS		0x0800
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_DATABASE_ENTRY_DEFAULTS	0x006B
4648c2ecf20Sopenharmony_ci#define IPV6_DEFAULT_DDB_ENTRY			0x0001
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci#define MBOX_CMD_CONN_OPEN_SESS_LOGIN		0x0074
4678c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_CRASH_RECORD		0x0076	/* 4010 only */
4688c2ecf20Sopenharmony_ci#define MBOX_CMD_GET_CONN_EVENT_LOG		0x0077
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci#define MBOX_CMD_IDC_ACK			0x0101
4718c2ecf20Sopenharmony_ci#define MBOX_CMD_IDC_TIME_EXTEND		0x0102
4728c2ecf20Sopenharmony_ci#define MBOX_CMD_PORT_RESET			0x0120
4738c2ecf20Sopenharmony_ci#define MBOX_CMD_SET_PORT_CONFIG		0x0122
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci/*  Mailbox status definitions */
4768c2ecf20Sopenharmony_ci#define MBOX_COMPLETION_STATUS			4
4778c2ecf20Sopenharmony_ci#define MBOX_STS_BUSY				0x0007
4788c2ecf20Sopenharmony_ci#define MBOX_STS_INTERMEDIATE_COMPLETION	0x1000
4798c2ecf20Sopenharmony_ci#define MBOX_STS_COMMAND_COMPLETE		0x4000
4808c2ecf20Sopenharmony_ci#define MBOX_STS_COMMAND_ERROR			0x4005
4818c2ecf20Sopenharmony_ci
4828c2ecf20Sopenharmony_ci#define MBOX_ASYNC_EVENT_STATUS			8
4838c2ecf20Sopenharmony_ci#define MBOX_ASTS_SYSTEM_ERROR			0x8002
4848c2ecf20Sopenharmony_ci#define MBOX_ASTS_REQUEST_TRANSFER_ERROR	0x8003
4858c2ecf20Sopenharmony_ci#define MBOX_ASTS_RESPONSE_TRANSFER_ERROR	0x8004
4868c2ecf20Sopenharmony_ci#define MBOX_ASTS_PROTOCOL_STATISTIC_ALARM	0x8005
4878c2ecf20Sopenharmony_ci#define MBOX_ASTS_SCSI_COMMAND_PDU_REJECTED	0x8006
4888c2ecf20Sopenharmony_ci#define MBOX_ASTS_LINK_UP			0x8010
4898c2ecf20Sopenharmony_ci#define MBOX_ASTS_LINK_DOWN			0x8011
4908c2ecf20Sopenharmony_ci#define MBOX_ASTS_DATABASE_CHANGED		0x8014
4918c2ecf20Sopenharmony_ci#define MBOX_ASTS_UNSOLICITED_PDU_RECEIVED	0x8015
4928c2ecf20Sopenharmony_ci#define MBOX_ASTS_SELF_TEST_FAILED		0x8016
4938c2ecf20Sopenharmony_ci#define MBOX_ASTS_LOGIN_FAILED			0x8017
4948c2ecf20Sopenharmony_ci#define MBOX_ASTS_DNS				0x8018
4958c2ecf20Sopenharmony_ci#define MBOX_ASTS_HEARTBEAT			0x8019
4968c2ecf20Sopenharmony_ci#define MBOX_ASTS_NVRAM_INVALID			0x801A
4978c2ecf20Sopenharmony_ci#define MBOX_ASTS_MAC_ADDRESS_CHANGED		0x801B
4988c2ecf20Sopenharmony_ci#define MBOX_ASTS_IP_ADDRESS_CHANGED		0x801C
4998c2ecf20Sopenharmony_ci#define MBOX_ASTS_DHCP_LEASE_EXPIRED		0x801D
5008c2ecf20Sopenharmony_ci#define MBOX_ASTS_DHCP_LEASE_ACQUIRED		0x801F
5018c2ecf20Sopenharmony_ci#define MBOX_ASTS_ISNS_UNSOLICITED_PDU_RECEIVED 0x8021
5028c2ecf20Sopenharmony_ci#define MBOX_ASTS_DUPLICATE_IP			0x8025
5038c2ecf20Sopenharmony_ci#define MBOX_ASTS_ARP_COMPLETE			0x8026
5048c2ecf20Sopenharmony_ci#define MBOX_ASTS_SUBNET_STATE_CHANGE		0x8027
5058c2ecf20Sopenharmony_ci#define MBOX_ASTS_RESPONSE_QUEUE_FULL		0x8028
5068c2ecf20Sopenharmony_ci#define MBOX_ASTS_IP_ADDR_STATE_CHANGED		0x8029
5078c2ecf20Sopenharmony_ci#define MBOX_ASTS_IPV6_DEFAULT_ROUTER_CHANGED	0x802A
5088c2ecf20Sopenharmony_ci#define MBOX_ASTS_IPV6_LINK_MTU_CHANGE		0x802B
5098c2ecf20Sopenharmony_ci#define MBOX_ASTS_IPV6_AUTO_PREFIX_IGNORED	0x802C
5108c2ecf20Sopenharmony_ci#define MBOX_ASTS_IPV6_ND_LOCAL_PREFIX_IGNORED	0x802D
5118c2ecf20Sopenharmony_ci#define MBOX_ASTS_ICMPV6_ERROR_MSG_RCVD		0x802E
5128c2ecf20Sopenharmony_ci#define MBOX_ASTS_INITIALIZATION_FAILED		0x8031
5138c2ecf20Sopenharmony_ci#define MBOX_ASTS_SYSTEM_WARNING_EVENT		0x8036
5148c2ecf20Sopenharmony_ci#define MBOX_ASTS_IDC_COMPLETE			0x8100
5158c2ecf20Sopenharmony_ci#define MBOX_ASTS_IDC_REQUEST_NOTIFICATION	0x8101
5168c2ecf20Sopenharmony_ci#define MBOX_ASTS_IDC_TIME_EXTEND_NOTIFICATION	0x8102
5178c2ecf20Sopenharmony_ci#define MBOX_ASTS_DCBX_CONF_CHANGE		0x8110
5188c2ecf20Sopenharmony_ci#define MBOX_ASTS_TXSCVR_INSERTED		0x8130
5198c2ecf20Sopenharmony_ci#define MBOX_ASTS_TXSCVR_REMOVED		0x8131
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci#define ISNS_EVENT_DATA_RECEIVED		0x0000
5228c2ecf20Sopenharmony_ci#define ISNS_EVENT_CONNECTION_OPENED		0x0001
5238c2ecf20Sopenharmony_ci#define ISNS_EVENT_CONNECTION_FAILED		0x0002
5248c2ecf20Sopenharmony_ci#define MBOX_ASTS_IPSEC_SYSTEM_FATAL_ERROR	0x8022
5258c2ecf20Sopenharmony_ci#define MBOX_ASTS_SUBNET_STATE_CHANGE		0x8027
5268c2ecf20Sopenharmony_ci
5278c2ecf20Sopenharmony_ci/* ACB Configuration Defines */
5288c2ecf20Sopenharmony_ci#define ACB_CONFIG_DISABLE		0x00
5298c2ecf20Sopenharmony_ci#define ACB_CONFIG_SET			0x01
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci/* ACB/IP Address State Defines */
5328c2ecf20Sopenharmony_ci#define IP_ADDRSTATE_UNCONFIGURED	0
5338c2ecf20Sopenharmony_ci#define IP_ADDRSTATE_INVALID		1
5348c2ecf20Sopenharmony_ci#define IP_ADDRSTATE_ACQUIRING		2
5358c2ecf20Sopenharmony_ci#define IP_ADDRSTATE_TENTATIVE		3
5368c2ecf20Sopenharmony_ci#define IP_ADDRSTATE_DEPRICATED		4
5378c2ecf20Sopenharmony_ci#define IP_ADDRSTATE_PREFERRED		5
5388c2ecf20Sopenharmony_ci#define IP_ADDRSTATE_DISABLING		6
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_ci/* FLASH offsets */
5418c2ecf20Sopenharmony_ci#define FLASH_SEGMENT_IFCB	0x04000000
5428c2ecf20Sopenharmony_ci
5438c2ecf20Sopenharmony_ci#define FLASH_OPT_RMW_HOLD	0
5448c2ecf20Sopenharmony_ci#define FLASH_OPT_RMW_INIT	1
5458c2ecf20Sopenharmony_ci#define FLASH_OPT_COMMIT	2
5468c2ecf20Sopenharmony_ci#define FLASH_OPT_RMW_COMMIT	3
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci/* generic defines to enable/disable params */
5498c2ecf20Sopenharmony_ci#define QL4_PARAM_DISABLE	0
5508c2ecf20Sopenharmony_ci#define QL4_PARAM_ENABLE	1
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci/*************************************************************************/
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci/* Host Adapter Initialization Control Block (from host) */
5558c2ecf20Sopenharmony_cistruct addr_ctrl_blk {
5568c2ecf20Sopenharmony_ci	uint8_t version;	/* 00 */
5578c2ecf20Sopenharmony_ci#define  IFCB_VER_MIN			0x01
5588c2ecf20Sopenharmony_ci#define  IFCB_VER_MAX			0x02
5598c2ecf20Sopenharmony_ci	uint8_t control;	/* 01 */
5608c2ecf20Sopenharmony_ci#define	 CTRLOPT_NEW_CONN_DISABLE	0x0002
5618c2ecf20Sopenharmony_ci
5628c2ecf20Sopenharmony_ci	uint16_t fw_options;	/* 02-03 */
5638c2ecf20Sopenharmony_ci#define	 FWOPT_HEARTBEAT_ENABLE		  0x1000
5648c2ecf20Sopenharmony_ci#define	 FWOPT_SESSION_MODE		  0x0040
5658c2ecf20Sopenharmony_ci#define	 FWOPT_INITIATOR_MODE		  0x0020
5668c2ecf20Sopenharmony_ci#define	 FWOPT_TARGET_MODE		  0x0010
5678c2ecf20Sopenharmony_ci#define	 FWOPT_ENABLE_CRBDB		  0x8000
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_ci	uint16_t exec_throttle;	/* 04-05 */
5708c2ecf20Sopenharmony_ci	uint8_t zio_count;	/* 06 */
5718c2ecf20Sopenharmony_ci	uint8_t res0;	/* 07 */
5728c2ecf20Sopenharmony_ci	uint16_t eth_mtu_size;	/* 08-09 */
5738c2ecf20Sopenharmony_ci	uint16_t add_fw_options;	/* 0A-0B */
5748c2ecf20Sopenharmony_ci#define ADFWOPT_SERIALIZE_TASK_MGMT	0x0400
5758c2ecf20Sopenharmony_ci#define ADFWOPT_AUTOCONN_DISABLE	0x0002
5768c2ecf20Sopenharmony_ci
5778c2ecf20Sopenharmony_ci	uint8_t hb_interval;	/* 0C */
5788c2ecf20Sopenharmony_ci	uint8_t inst_num; /* 0D */
5798c2ecf20Sopenharmony_ci	uint16_t res1;		/* 0E-0F */
5808c2ecf20Sopenharmony_ci	uint16_t rqq_consumer_idx;	/* 10-11 */
5818c2ecf20Sopenharmony_ci	uint16_t compq_producer_idx;	/* 12-13 */
5828c2ecf20Sopenharmony_ci	uint16_t rqq_len;	/* 14-15 */
5838c2ecf20Sopenharmony_ci	uint16_t compq_len;	/* 16-17 */
5848c2ecf20Sopenharmony_ci	uint32_t rqq_addr_lo;	/* 18-1B */
5858c2ecf20Sopenharmony_ci	uint32_t rqq_addr_hi;	/* 1C-1F */
5868c2ecf20Sopenharmony_ci	uint32_t compq_addr_lo;	/* 20-23 */
5878c2ecf20Sopenharmony_ci	uint32_t compq_addr_hi;	/* 24-27 */
5888c2ecf20Sopenharmony_ci	uint32_t shdwreg_addr_lo;	/* 28-2B */
5898c2ecf20Sopenharmony_ci	uint32_t shdwreg_addr_hi;	/* 2C-2F */
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci	uint16_t iscsi_opts;	/* 30-31 */
5928c2ecf20Sopenharmony_ci#define ISCSIOPTS_HEADER_DIGEST_EN		0x2000
5938c2ecf20Sopenharmony_ci#define ISCSIOPTS_DATA_DIGEST_EN		0x1000
5948c2ecf20Sopenharmony_ci#define ISCSIOPTS_IMMEDIATE_DATA_EN		0x0800
5958c2ecf20Sopenharmony_ci#define ISCSIOPTS_INITIAL_R2T_EN		0x0400
5968c2ecf20Sopenharmony_ci#define ISCSIOPTS_DATA_SEQ_INORDER_EN		0x0200
5978c2ecf20Sopenharmony_ci#define ISCSIOPTS_DATA_PDU_INORDER_EN		0x0100
5988c2ecf20Sopenharmony_ci#define ISCSIOPTS_CHAP_AUTH_EN			0x0080
5998c2ecf20Sopenharmony_ci#define ISCSIOPTS_SNACK_EN			0x0040
6008c2ecf20Sopenharmony_ci#define ISCSIOPTS_DISCOVERY_LOGOUT_EN		0x0020
6018c2ecf20Sopenharmony_ci#define ISCSIOPTS_BIDI_CHAP_EN			0x0010
6028c2ecf20Sopenharmony_ci#define ISCSIOPTS_DISCOVERY_AUTH_EN		0x0008
6038c2ecf20Sopenharmony_ci#define ISCSIOPTS_STRICT_LOGIN_COMP_EN		0x0004
6048c2ecf20Sopenharmony_ci#define ISCSIOPTS_ERL				0x0003
6058c2ecf20Sopenharmony_ci	uint16_t ipv4_tcp_opts;	/* 32-33 */
6068c2ecf20Sopenharmony_ci#define TCPOPT_DELAYED_ACK_DISABLE	0x8000
6078c2ecf20Sopenharmony_ci#define TCPOPT_DHCP_ENABLE		0x0200
6088c2ecf20Sopenharmony_ci#define TCPOPT_DNS_SERVER_IP_EN		0x0100
6098c2ecf20Sopenharmony_ci#define TCPOPT_SLP_DA_INFO_EN		0x0080
6108c2ecf20Sopenharmony_ci#define TCPOPT_NAGLE_ALGO_DISABLE	0x0020
6118c2ecf20Sopenharmony_ci#define TCPOPT_WINDOW_SCALE_DISABLE	0x0010
6128c2ecf20Sopenharmony_ci#define TCPOPT_TIMER_SCALE		0x000E
6138c2ecf20Sopenharmony_ci#define TCPOPT_TIMESTAMP_ENABLE		0x0001
6148c2ecf20Sopenharmony_ci	uint16_t ipv4_ip_opts;	/* 34-35 */
6158c2ecf20Sopenharmony_ci#define IPOPT_IPV4_PROTOCOL_ENABLE	0x8000
6168c2ecf20Sopenharmony_ci#define IPOPT_IPV4_TOS_EN		0x4000
6178c2ecf20Sopenharmony_ci#define IPOPT_VLAN_TAGGING_ENABLE	0x2000
6188c2ecf20Sopenharmony_ci#define IPOPT_GRAT_ARP_EN		0x1000
6198c2ecf20Sopenharmony_ci#define IPOPT_ALT_CID_EN		0x0800
6208c2ecf20Sopenharmony_ci#define IPOPT_REQ_VID_EN		0x0400
6218c2ecf20Sopenharmony_ci#define IPOPT_USE_VID_EN		0x0200
6228c2ecf20Sopenharmony_ci#define IPOPT_LEARN_IQN_EN		0x0100
6238c2ecf20Sopenharmony_ci#define IPOPT_FRAGMENTATION_DISABLE	0x0010
6248c2ecf20Sopenharmony_ci#define IPOPT_IN_FORWARD_EN		0x0008
6258c2ecf20Sopenharmony_ci#define IPOPT_ARP_REDIRECT_EN		0x0004
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci	uint16_t iscsi_max_pdu_size;	/* 36-37 */
6288c2ecf20Sopenharmony_ci	uint8_t ipv4_tos;	/* 38 */
6298c2ecf20Sopenharmony_ci	uint8_t ipv4_ttl;	/* 39 */
6308c2ecf20Sopenharmony_ci	uint8_t acb_version;	/* 3A */
6318c2ecf20Sopenharmony_ci#define ACB_NOT_SUPPORTED		0x00
6328c2ecf20Sopenharmony_ci#define ACB_SUPPORTED			0x02 /* Capable of ACB Version 2
6338c2ecf20Sopenharmony_ci						Features */
6348c2ecf20Sopenharmony_ci
6358c2ecf20Sopenharmony_ci	uint8_t res2;	/* 3B */
6368c2ecf20Sopenharmony_ci	uint16_t def_timeout;	/* 3C-3D */
6378c2ecf20Sopenharmony_ci	uint16_t iscsi_fburst_len;	/* 3E-3F */
6388c2ecf20Sopenharmony_ci	uint16_t iscsi_def_time2wait;	/* 40-41 */
6398c2ecf20Sopenharmony_ci	uint16_t iscsi_def_time2retain;	/* 42-43 */
6408c2ecf20Sopenharmony_ci	uint16_t iscsi_max_outstnd_r2t;	/* 44-45 */
6418c2ecf20Sopenharmony_ci	uint16_t conn_ka_timeout;	/* 46-47 */
6428c2ecf20Sopenharmony_ci	uint16_t ipv4_port;	/* 48-49 */
6438c2ecf20Sopenharmony_ci	uint16_t iscsi_max_burst_len;	/* 4A-4B */
6448c2ecf20Sopenharmony_ci	uint32_t res5;		/* 4C-4F */
6458c2ecf20Sopenharmony_ci	uint8_t ipv4_addr[4];	/* 50-53 */
6468c2ecf20Sopenharmony_ci	uint16_t ipv4_vlan_tag;	/* 54-55 */
6478c2ecf20Sopenharmony_ci	uint8_t ipv4_addr_state;	/* 56 */
6488c2ecf20Sopenharmony_ci	uint8_t ipv4_cacheid;	/* 57 */
6498c2ecf20Sopenharmony_ci	uint8_t res6[8];	/* 58-5F */
6508c2ecf20Sopenharmony_ci	uint8_t ipv4_subnet[4];	/* 60-63 */
6518c2ecf20Sopenharmony_ci	uint8_t res7[12];	/* 64-6F */
6528c2ecf20Sopenharmony_ci	uint8_t ipv4_gw_addr[4];	/* 70-73 */
6538c2ecf20Sopenharmony_ci	uint8_t res8[0xc];	/* 74-7F */
6548c2ecf20Sopenharmony_ci	uint8_t pri_dns_srvr_ip[4];/* 80-83 */
6558c2ecf20Sopenharmony_ci	uint8_t sec_dns_srvr_ip[4];/* 84-87 */
6568c2ecf20Sopenharmony_ci	uint16_t min_eph_port;	/* 88-89 */
6578c2ecf20Sopenharmony_ci	uint16_t max_eph_port;	/* 8A-8B */
6588c2ecf20Sopenharmony_ci	uint8_t res9[4];	/* 8C-8F */
6598c2ecf20Sopenharmony_ci	uint8_t iscsi_alias[32];/* 90-AF */
6608c2ecf20Sopenharmony_ci	uint8_t res9_1[0x16];	/* B0-C5 */
6618c2ecf20Sopenharmony_ci	uint16_t tgt_portal_grp;/* C6-C7 */
6628c2ecf20Sopenharmony_ci	uint8_t abort_timer;	/* C8	 */
6638c2ecf20Sopenharmony_ci	uint8_t ipv4_tcp_wsf;	/* C9	 */
6648c2ecf20Sopenharmony_ci	uint8_t res10[6];	/* CA-CF */
6658c2ecf20Sopenharmony_ci	uint8_t ipv4_sec_ip_addr[4];	/* D0-D3 */
6668c2ecf20Sopenharmony_ci	uint8_t ipv4_dhcp_vid_len;	/* D4 */
6678c2ecf20Sopenharmony_ci	uint8_t ipv4_dhcp_vid[11];	/* D5-DF */
6688c2ecf20Sopenharmony_ci	uint8_t res11[20];	/* E0-F3 */
6698c2ecf20Sopenharmony_ci	uint8_t ipv4_dhcp_alt_cid_len;	/* F4 */
6708c2ecf20Sopenharmony_ci	uint8_t ipv4_dhcp_alt_cid[11];	/* F5-FF */
6718c2ecf20Sopenharmony_ci	uint8_t iscsi_name[224];	/* 100-1DF */
6728c2ecf20Sopenharmony_ci	uint8_t res12[32];	/* 1E0-1FF */
6738c2ecf20Sopenharmony_ci	uint32_t cookie;	/* 200-203 */
6748c2ecf20Sopenharmony_ci	uint16_t ipv6_port;	/* 204-205 */
6758c2ecf20Sopenharmony_ci	uint16_t ipv6_opts;	/* 206-207 */
6768c2ecf20Sopenharmony_ci#define IPV6_OPT_IPV6_PROTOCOL_ENABLE		0x8000
6778c2ecf20Sopenharmony_ci#define IPV6_OPT_VLAN_TAGGING_ENABLE		0x2000
6788c2ecf20Sopenharmony_ci#define IPV6_OPT_GRAT_NEIGHBOR_ADV_EN		0x1000
6798c2ecf20Sopenharmony_ci#define IPV6_OPT_REDIRECT_EN			0x0004
6808c2ecf20Sopenharmony_ci
6818c2ecf20Sopenharmony_ci	uint16_t ipv6_addtl_opts;	/* 208-209 */
6828c2ecf20Sopenharmony_ci#define IPV6_ADDOPT_IGNORE_ICMP_ECHO_REQ		0x0040
6838c2ecf20Sopenharmony_ci#define IPV6_ADDOPT_MLD_EN				0x0004
6848c2ecf20Sopenharmony_ci#define IPV6_ADDOPT_NEIGHBOR_DISCOVERY_ADDR_ENABLE	0x0002 /* Pri ACB
6858c2ecf20Sopenharmony_ci								  Only */
6868c2ecf20Sopenharmony_ci#define IPV6_ADDOPT_AUTOCONFIG_LINK_LOCAL_ADDR		0x0001
6878c2ecf20Sopenharmony_ci
6888c2ecf20Sopenharmony_ci	uint16_t ipv6_tcp_opts;	/* 20A-20B */
6898c2ecf20Sopenharmony_ci#define IPV6_TCPOPT_DELAYED_ACK_DISABLE		0x8000
6908c2ecf20Sopenharmony_ci#define IPV6_TCPOPT_NAGLE_ALGO_DISABLE		0x0020
6918c2ecf20Sopenharmony_ci#define IPV6_TCPOPT_WINDOW_SCALE_DISABLE	0x0010
6928c2ecf20Sopenharmony_ci#define IPV6_TCPOPT_TIMER_SCALE			0x000E
6938c2ecf20Sopenharmony_ci#define IPV6_TCPOPT_TIMESTAMP_EN		0x0001
6948c2ecf20Sopenharmony_ci	uint8_t ipv6_tcp_wsf;	/* 20C */
6958c2ecf20Sopenharmony_ci	uint16_t ipv6_flow_lbl;	/* 20D-20F */
6968c2ecf20Sopenharmony_ci	uint8_t ipv6_dflt_rtr_addr[16]; /* 210-21F */
6978c2ecf20Sopenharmony_ci	uint16_t ipv6_vlan_tag;	/* 220-221 */
6988c2ecf20Sopenharmony_ci	uint8_t ipv6_lnk_lcl_addr_state;/* 222 */
6998c2ecf20Sopenharmony_ci	uint8_t ipv6_addr0_state;	/* 223 */
7008c2ecf20Sopenharmony_ci	uint8_t ipv6_addr1_state;	/* 224 */
7018c2ecf20Sopenharmony_ci	uint8_t ipv6_dflt_rtr_state;    /* 225 */
7028c2ecf20Sopenharmony_ci#define IPV6_RTRSTATE_UNKNOWN                   0
7038c2ecf20Sopenharmony_ci#define IPV6_RTRSTATE_MANUAL                    1
7048c2ecf20Sopenharmony_ci#define IPV6_RTRSTATE_ADVERTISED                3
7058c2ecf20Sopenharmony_ci#define IPV6_RTRSTATE_STALE                     4
7068c2ecf20Sopenharmony_ci
7078c2ecf20Sopenharmony_ci	uint8_t ipv6_traffic_class;	/* 226 */
7088c2ecf20Sopenharmony_ci	uint8_t ipv6_hop_limit;	/* 227 */
7098c2ecf20Sopenharmony_ci	uint8_t ipv6_if_id[8];	/* 228-22F */
7108c2ecf20Sopenharmony_ci	uint8_t ipv6_addr0[16];	/* 230-23F */
7118c2ecf20Sopenharmony_ci	uint8_t ipv6_addr1[16];	/* 240-24F */
7128c2ecf20Sopenharmony_ci	uint32_t ipv6_nd_reach_time;	/* 250-253 */
7138c2ecf20Sopenharmony_ci	uint32_t ipv6_nd_rexmit_timer;	/* 254-257 */
7148c2ecf20Sopenharmony_ci	uint32_t ipv6_nd_stale_timeout;	/* 258-25B */
7158c2ecf20Sopenharmony_ci	uint8_t ipv6_dup_addr_detect_count;	/* 25C */
7168c2ecf20Sopenharmony_ci	uint8_t ipv6_cache_id;	/* 25D */
7178c2ecf20Sopenharmony_ci	uint8_t res13[18];	/* 25E-26F */
7188c2ecf20Sopenharmony_ci	uint32_t ipv6_gw_advrt_mtu;	/* 270-273 */
7198c2ecf20Sopenharmony_ci	uint8_t res14[140];	/* 274-2FF */
7208c2ecf20Sopenharmony_ci};
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci#define IP_ADDR_COUNT	4 /* Total 4 IP address supported in one interface
7238c2ecf20Sopenharmony_ci			   * One IPv4, one IPv6 link local and 2 IPv6
7248c2ecf20Sopenharmony_ci			   */
7258c2ecf20Sopenharmony_ci
7268c2ecf20Sopenharmony_ci#define IP_STATE_MASK	0x0F000000
7278c2ecf20Sopenharmony_ci#define IP_STATE_SHIFT	24
7288c2ecf20Sopenharmony_ci
7298c2ecf20Sopenharmony_cistruct init_fw_ctrl_blk {
7308c2ecf20Sopenharmony_ci	struct addr_ctrl_blk pri;
7318c2ecf20Sopenharmony_ci/*	struct addr_ctrl_blk sec;*/
7328c2ecf20Sopenharmony_ci};
7338c2ecf20Sopenharmony_ci
7348c2ecf20Sopenharmony_ci#define PRIMARI_ACB		0
7358c2ecf20Sopenharmony_ci#define SECONDARY_ACB		1
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_cistruct addr_ctrl_blk_def {
7388c2ecf20Sopenharmony_ci	uint8_t reserved1[1];	/* 00 */
7398c2ecf20Sopenharmony_ci	uint8_t control;	/* 01 */
7408c2ecf20Sopenharmony_ci	uint8_t reserved2[11];	/* 02-0C */
7418c2ecf20Sopenharmony_ci	uint8_t inst_num;	/* 0D */
7428c2ecf20Sopenharmony_ci	uint8_t reserved3[34];	/* 0E-2F */
7438c2ecf20Sopenharmony_ci	uint16_t iscsi_opts;	/* 30-31 */
7448c2ecf20Sopenharmony_ci	uint16_t ipv4_tcp_opts;	/* 32-33 */
7458c2ecf20Sopenharmony_ci	uint16_t ipv4_ip_opts;	/* 34-35 */
7468c2ecf20Sopenharmony_ci	uint16_t iscsi_max_pdu_size;	/* 36-37 */
7478c2ecf20Sopenharmony_ci	uint8_t ipv4_tos;	/* 38 */
7488c2ecf20Sopenharmony_ci	uint8_t ipv4_ttl;	/* 39 */
7498c2ecf20Sopenharmony_ci	uint8_t reserved4[2];	/* 3A-3B */
7508c2ecf20Sopenharmony_ci	uint16_t def_timeout;	/* 3C-3D */
7518c2ecf20Sopenharmony_ci	uint16_t iscsi_fburst_len;	/* 3E-3F */
7528c2ecf20Sopenharmony_ci	uint8_t reserved5[4];	/* 40-43 */
7538c2ecf20Sopenharmony_ci	uint16_t iscsi_max_outstnd_r2t;	/* 44-45 */
7548c2ecf20Sopenharmony_ci	uint8_t reserved6[2];	/* 46-47 */
7558c2ecf20Sopenharmony_ci	uint16_t ipv4_port;	/* 48-49 */
7568c2ecf20Sopenharmony_ci	uint16_t iscsi_max_burst_len;	/* 4A-4B */
7578c2ecf20Sopenharmony_ci	uint8_t reserved7[4];	/* 4C-4F */
7588c2ecf20Sopenharmony_ci	uint8_t ipv4_addr[4];	/* 50-53 */
7598c2ecf20Sopenharmony_ci	uint16_t ipv4_vlan_tag;	/* 54-55 */
7608c2ecf20Sopenharmony_ci	uint8_t ipv4_addr_state;	/* 56 */
7618c2ecf20Sopenharmony_ci	uint8_t ipv4_cacheid;	/* 57 */
7628c2ecf20Sopenharmony_ci	uint8_t reserved8[8];	/* 58-5F */
7638c2ecf20Sopenharmony_ci	uint8_t ipv4_subnet[4];	/* 60-63 */
7648c2ecf20Sopenharmony_ci	uint8_t reserved9[12];	/* 64-6F */
7658c2ecf20Sopenharmony_ci	uint8_t ipv4_gw_addr[4];	/* 70-73 */
7668c2ecf20Sopenharmony_ci	uint8_t reserved10[84];	/* 74-C7 */
7678c2ecf20Sopenharmony_ci	uint8_t abort_timer;	/* C8    */
7688c2ecf20Sopenharmony_ci	uint8_t ipv4_tcp_wsf;	/* C9    */
7698c2ecf20Sopenharmony_ci	uint8_t reserved11[10];	/* CA-D3 */
7708c2ecf20Sopenharmony_ci	uint8_t ipv4_dhcp_vid_len;	/* D4 */
7718c2ecf20Sopenharmony_ci	uint8_t ipv4_dhcp_vid[11];	/* D5-DF */
7728c2ecf20Sopenharmony_ci	uint8_t reserved12[20];	/* E0-F3 */
7738c2ecf20Sopenharmony_ci	uint8_t ipv4_dhcp_alt_cid_len;	/* F4 */
7748c2ecf20Sopenharmony_ci	uint8_t ipv4_dhcp_alt_cid[11];	/* F5-FF */
7758c2ecf20Sopenharmony_ci	uint8_t iscsi_name[224];	/* 100-1DF */
7768c2ecf20Sopenharmony_ci	uint8_t reserved13[32];	/* 1E0-1FF */
7778c2ecf20Sopenharmony_ci	uint32_t cookie;	/* 200-203 */
7788c2ecf20Sopenharmony_ci	uint16_t ipv6_port;	/* 204-205 */
7798c2ecf20Sopenharmony_ci	uint16_t ipv6_opts;	/* 206-207 */
7808c2ecf20Sopenharmony_ci	uint16_t ipv6_addtl_opts;	/* 208-209 */
7818c2ecf20Sopenharmony_ci	uint16_t ipv6_tcp_opts;		/* 20A-20B */
7828c2ecf20Sopenharmony_ci	uint8_t ipv6_tcp_wsf;		/* 20C */
7838c2ecf20Sopenharmony_ci	uint16_t ipv6_flow_lbl;		/* 20D-20F */
7848c2ecf20Sopenharmony_ci	uint8_t ipv6_dflt_rtr_addr[16];	/* 210-21F */
7858c2ecf20Sopenharmony_ci	uint16_t ipv6_vlan_tag;		/* 220-221 */
7868c2ecf20Sopenharmony_ci	uint8_t ipv6_lnk_lcl_addr_state;	/* 222 */
7878c2ecf20Sopenharmony_ci	uint8_t ipv6_addr0_state;	/* 223 */
7888c2ecf20Sopenharmony_ci	uint8_t ipv6_addr1_state;	/* 224 */
7898c2ecf20Sopenharmony_ci	uint8_t ipv6_dflt_rtr_state;	/* 225 */
7908c2ecf20Sopenharmony_ci	uint8_t ipv6_traffic_class;	/* 226 */
7918c2ecf20Sopenharmony_ci	uint8_t ipv6_hop_limit;		/* 227 */
7928c2ecf20Sopenharmony_ci	uint8_t ipv6_if_id[8];		/* 228-22F */
7938c2ecf20Sopenharmony_ci	uint8_t ipv6_addr0[16];		/* 230-23F */
7948c2ecf20Sopenharmony_ci	uint8_t ipv6_addr1[16];		/* 240-24F */
7958c2ecf20Sopenharmony_ci	uint32_t ipv6_nd_reach_time;	/* 250-253 */
7968c2ecf20Sopenharmony_ci	uint32_t ipv6_nd_rexmit_timer;	/* 254-257 */
7978c2ecf20Sopenharmony_ci	uint32_t ipv6_nd_stale_timeout;	/* 258-25B */
7988c2ecf20Sopenharmony_ci	uint8_t ipv6_dup_addr_detect_count;	/* 25C */
7998c2ecf20Sopenharmony_ci	uint8_t ipv6_cache_id;		/* 25D */
8008c2ecf20Sopenharmony_ci	uint8_t reserved14[18];		/* 25E-26F */
8018c2ecf20Sopenharmony_ci	uint32_t ipv6_gw_advrt_mtu;	/* 270-273 */
8028c2ecf20Sopenharmony_ci	uint8_t reserved15[140];	/* 274-2FF */
8038c2ecf20Sopenharmony_ci};
8048c2ecf20Sopenharmony_ci
8058c2ecf20Sopenharmony_ci/*************************************************************************/
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_ci#define MAX_CHAP_ENTRIES_40XX	128
8088c2ecf20Sopenharmony_ci#define MAX_CHAP_ENTRIES_82XX	1024
8098c2ecf20Sopenharmony_ci#define MAX_RESRV_CHAP_IDX	3
8108c2ecf20Sopenharmony_ci#define FLASH_CHAP_OFFSET	0x06000000
8118c2ecf20Sopenharmony_ci
8128c2ecf20Sopenharmony_cistruct ql4_chap_table {
8138c2ecf20Sopenharmony_ci	uint16_t link;
8148c2ecf20Sopenharmony_ci	uint8_t flags;
8158c2ecf20Sopenharmony_ci	uint8_t secret_len;
8168c2ecf20Sopenharmony_ci#define MIN_CHAP_SECRET_LEN	12
8178c2ecf20Sopenharmony_ci#define MAX_CHAP_SECRET_LEN	100
8188c2ecf20Sopenharmony_ci	uint8_t secret[MAX_CHAP_SECRET_LEN];
8198c2ecf20Sopenharmony_ci#define MAX_CHAP_NAME_LEN	256
8208c2ecf20Sopenharmony_ci	uint8_t name[MAX_CHAP_NAME_LEN];
8218c2ecf20Sopenharmony_ci	uint16_t reserved;
8228c2ecf20Sopenharmony_ci#define CHAP_VALID_COOKIE	0x4092
8238c2ecf20Sopenharmony_ci#define CHAP_INVALID_COOKIE	0xFFEE
8248c2ecf20Sopenharmony_ci	uint16_t cookie;
8258c2ecf20Sopenharmony_ci};
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_cistruct dev_db_entry {
8288c2ecf20Sopenharmony_ci	uint16_t options;	/* 00-01 */
8298c2ecf20Sopenharmony_ci#define DDB_OPT_DISC_SESSION  0x10
8308c2ecf20Sopenharmony_ci#define DDB_OPT_TARGET	      0x02 /* device is a target */
8318c2ecf20Sopenharmony_ci#define DDB_OPT_IPV6_DEVICE	0x100
8328c2ecf20Sopenharmony_ci#define DDB_OPT_AUTO_SENDTGTS_DISABLE		0x40
8338c2ecf20Sopenharmony_ci#define DDB_OPT_IPV6_NULL_LINK_LOCAL		0x800 /* post connection */
8348c2ecf20Sopenharmony_ci#define DDB_OPT_IPV6_FW_DEFINED_LINK_LOCAL	0x800 /* pre connection */
8358c2ecf20Sopenharmony_ci
8368c2ecf20Sopenharmony_ci#define OPT_IS_FW_ASSIGNED_IPV6		11
8378c2ecf20Sopenharmony_ci#define OPT_IPV6_DEVICE			8
8388c2ecf20Sopenharmony_ci#define OPT_AUTO_SENDTGTS_DISABLE	6
8398c2ecf20Sopenharmony_ci#define OPT_DISC_SESSION		4
8408c2ecf20Sopenharmony_ci#define OPT_ENTRY_STATE			3
8418c2ecf20Sopenharmony_ci	uint16_t exec_throttle;	/* 02-03 */
8428c2ecf20Sopenharmony_ci	uint16_t exec_count;	/* 04-05 */
8438c2ecf20Sopenharmony_ci	uint16_t res0;	/* 06-07 */
8448c2ecf20Sopenharmony_ci	uint16_t iscsi_options;	/* 08-09 */
8458c2ecf20Sopenharmony_ci#define ISCSIOPT_HEADER_DIGEST_EN		13
8468c2ecf20Sopenharmony_ci#define ISCSIOPT_DATA_DIGEST_EN			12
8478c2ecf20Sopenharmony_ci#define ISCSIOPT_IMMEDIATE_DATA_EN		11
8488c2ecf20Sopenharmony_ci#define ISCSIOPT_INITIAL_R2T_EN			10
8498c2ecf20Sopenharmony_ci#define ISCSIOPT_DATA_SEQ_IN_ORDER		9
8508c2ecf20Sopenharmony_ci#define ISCSIOPT_DATA_PDU_IN_ORDER		8
8518c2ecf20Sopenharmony_ci#define ISCSIOPT_CHAP_AUTH_EN			7
8528c2ecf20Sopenharmony_ci#define ISCSIOPT_SNACK_REQ_EN			6
8538c2ecf20Sopenharmony_ci#define ISCSIOPT_DISCOVERY_LOGOUT_EN		5
8548c2ecf20Sopenharmony_ci#define ISCSIOPT_BIDI_CHAP_EN			4
8558c2ecf20Sopenharmony_ci#define ISCSIOPT_DISCOVERY_AUTH_OPTIONAL	3
8568c2ecf20Sopenharmony_ci#define ISCSIOPT_ERL1				1
8578c2ecf20Sopenharmony_ci#define ISCSIOPT_ERL0				0
8588c2ecf20Sopenharmony_ci
8598c2ecf20Sopenharmony_ci	uint16_t tcp_options;	/* 0A-0B */
8608c2ecf20Sopenharmony_ci#define TCPOPT_TIMESTAMP_STAT	6
8618c2ecf20Sopenharmony_ci#define TCPOPT_NAGLE_DISABLE	5
8628c2ecf20Sopenharmony_ci#define TCPOPT_WSF_DISABLE	4
8638c2ecf20Sopenharmony_ci#define TCPOPT_TIMER_SCALE3	3
8648c2ecf20Sopenharmony_ci#define TCPOPT_TIMER_SCALE2	2
8658c2ecf20Sopenharmony_ci#define TCPOPT_TIMER_SCALE1	1
8668c2ecf20Sopenharmony_ci#define TCPOPT_TIMESTAMP_EN	0
8678c2ecf20Sopenharmony_ci
8688c2ecf20Sopenharmony_ci	uint16_t ip_options;	/* 0C-0D */
8698c2ecf20Sopenharmony_ci#define IPOPT_FRAGMENT_DISABLE	4
8708c2ecf20Sopenharmony_ci
8718c2ecf20Sopenharmony_ci	uint16_t iscsi_max_rcv_data_seg_len;	/* 0E-0F */
8728c2ecf20Sopenharmony_ci#define BYTE_UNITS	512
8738c2ecf20Sopenharmony_ci	uint32_t res1;	/* 10-13 */
8748c2ecf20Sopenharmony_ci	uint16_t iscsi_max_snd_data_seg_len;	/* 14-15 */
8758c2ecf20Sopenharmony_ci	uint16_t iscsi_first_burst_len;	/* 16-17 */
8768c2ecf20Sopenharmony_ci	uint16_t iscsi_def_time2wait;	/* 18-19 */
8778c2ecf20Sopenharmony_ci	uint16_t iscsi_def_time2retain;	/* 1A-1B */
8788c2ecf20Sopenharmony_ci	uint16_t iscsi_max_outsnd_r2t;	/* 1C-1D */
8798c2ecf20Sopenharmony_ci	uint16_t ka_timeout;	/* 1E-1F */
8808c2ecf20Sopenharmony_ci	uint8_t isid[6];	/* 20-25 big-endian, must be converted
8818c2ecf20Sopenharmony_ci				 * to little-endian */
8828c2ecf20Sopenharmony_ci	uint16_t tsid;		/* 26-27 */
8838c2ecf20Sopenharmony_ci	uint16_t port;	/* 28-29 */
8848c2ecf20Sopenharmony_ci	uint16_t iscsi_max_burst_len;	/* 2A-2B */
8858c2ecf20Sopenharmony_ci	uint16_t def_timeout;	/* 2C-2D */
8868c2ecf20Sopenharmony_ci	uint16_t res2;	/* 2E-2F */
8878c2ecf20Sopenharmony_ci	uint8_t ip_addr[0x10];	/* 30-3F */
8888c2ecf20Sopenharmony_ci	uint8_t iscsi_alias[0x20];	/* 40-5F */
8898c2ecf20Sopenharmony_ci	uint8_t tgt_addr[0x20];	/* 60-7F */
8908c2ecf20Sopenharmony_ci	uint16_t mss;	/* 80-81 */
8918c2ecf20Sopenharmony_ci	uint16_t res3;	/* 82-83 */
8928c2ecf20Sopenharmony_ci	uint16_t lcl_port;	/* 84-85 */
8938c2ecf20Sopenharmony_ci	uint8_t ipv4_tos;	/* 86 */
8948c2ecf20Sopenharmony_ci	uint16_t ipv6_flow_lbl;	/* 87-89 */
8958c2ecf20Sopenharmony_ci	uint8_t res4[0x36];	/* 8A-BF */
8968c2ecf20Sopenharmony_ci	uint8_t iscsi_name[0xE0];	/* C0-19F : xxzzy Make this a
8978c2ecf20Sopenharmony_ci					 * pointer to a string so we
8988c2ecf20Sopenharmony_ci					 * don't have to reserve so
8998c2ecf20Sopenharmony_ci					 * much RAM */
9008c2ecf20Sopenharmony_ci	uint8_t link_local_ipv6_addr[0x10]; /* 1A0-1AF */
9018c2ecf20Sopenharmony_ci	uint8_t res5[0x10];	/* 1B0-1BF */
9028c2ecf20Sopenharmony_ci#define DDB_NO_LINK	0xFFFF
9038c2ecf20Sopenharmony_ci#define DDB_ISNS	0xFFFD
9048c2ecf20Sopenharmony_ci	uint16_t ddb_link;	/* 1C0-1C1 */
9058c2ecf20Sopenharmony_ci	uint16_t chap_tbl_idx;	/* 1C2-1C3 */
9068c2ecf20Sopenharmony_ci	uint16_t tgt_portal_grp; /* 1C4-1C5 */
9078c2ecf20Sopenharmony_ci	uint8_t tcp_xmt_wsf;	/* 1C6 */
9088c2ecf20Sopenharmony_ci	uint8_t tcp_rcv_wsf;	/* 1C7 */
9098c2ecf20Sopenharmony_ci	uint32_t stat_sn;	/* 1C8-1CB */
9108c2ecf20Sopenharmony_ci	uint32_t exp_stat_sn;	/* 1CC-1CF */
9118c2ecf20Sopenharmony_ci	uint8_t res6[0x2b];	/* 1D0-1FB */
9128c2ecf20Sopenharmony_ci#define DDB_VALID_COOKIE	0x9034
9138c2ecf20Sopenharmony_ci	uint16_t cookie;	/* 1FC-1FD */
9148c2ecf20Sopenharmony_ci	uint16_t len;		/* 1FE-1FF */
9158c2ecf20Sopenharmony_ci};
9168c2ecf20Sopenharmony_ci
9178c2ecf20Sopenharmony_ci/*************************************************************************/
9188c2ecf20Sopenharmony_ci
9198c2ecf20Sopenharmony_ci/* Flash definitions */
9208c2ecf20Sopenharmony_ci
9218c2ecf20Sopenharmony_ci#define FLASH_OFFSET_SYS_INFO	0x02000000
9228c2ecf20Sopenharmony_ci#define FLASH_DEFAULTBLOCKSIZE	0x20000
9238c2ecf20Sopenharmony_ci#define FLASH_EOF_OFFSET	(FLASH_DEFAULTBLOCKSIZE-8) /* 4 bytes
9248c2ecf20Sopenharmony_ci							    * for EOF
9258c2ecf20Sopenharmony_ci							    * signature */
9268c2ecf20Sopenharmony_ci#define FLASH_RAW_ACCESS_ADDR	0x8e000000
9278c2ecf20Sopenharmony_ci
9288c2ecf20Sopenharmony_ci#define BOOT_PARAM_OFFSET_PORT0 0x3b0
9298c2ecf20Sopenharmony_ci#define BOOT_PARAM_OFFSET_PORT1 0x7b0
9308c2ecf20Sopenharmony_ci
9318c2ecf20Sopenharmony_ci#define FLASH_OFFSET_DB_INFO	0x05000000
9328c2ecf20Sopenharmony_ci#define FLASH_OFFSET_DB_END	(FLASH_OFFSET_DB_INFO + 0x7fff)
9338c2ecf20Sopenharmony_ci
9348c2ecf20Sopenharmony_ci
9358c2ecf20Sopenharmony_cistruct sys_info_phys_addr {
9368c2ecf20Sopenharmony_ci	uint8_t address[6];	/* 00-05 */
9378c2ecf20Sopenharmony_ci	uint8_t filler[2];	/* 06-07 */
9388c2ecf20Sopenharmony_ci};
9398c2ecf20Sopenharmony_ci
9408c2ecf20Sopenharmony_cistruct flash_sys_info {
9418c2ecf20Sopenharmony_ci	uint32_t cookie;	/* 00-03 */
9428c2ecf20Sopenharmony_ci	uint32_t physAddrCount; /* 04-07 */
9438c2ecf20Sopenharmony_ci	struct sys_info_phys_addr physAddr[4]; /* 08-27 */
9448c2ecf20Sopenharmony_ci	uint8_t vendorId[128];	/* 28-A7 */
9458c2ecf20Sopenharmony_ci	uint8_t productId[128]; /* A8-127 */
9468c2ecf20Sopenharmony_ci	uint32_t serialNumber;	/* 128-12B */
9478c2ecf20Sopenharmony_ci
9488c2ecf20Sopenharmony_ci	/*  PCI Configuration values */
9498c2ecf20Sopenharmony_ci	uint32_t pciDeviceVendor;	/* 12C-12F */
9508c2ecf20Sopenharmony_ci	uint32_t pciDeviceId;	/* 130-133 */
9518c2ecf20Sopenharmony_ci	uint32_t pciSubsysVendor;	/* 134-137 */
9528c2ecf20Sopenharmony_ci	uint32_t pciSubsysId;	/* 138-13B */
9538c2ecf20Sopenharmony_ci
9548c2ecf20Sopenharmony_ci	/*  This validates version 1. */
9558c2ecf20Sopenharmony_ci	uint32_t crumbs;	/* 13C-13F */
9568c2ecf20Sopenharmony_ci
9578c2ecf20Sopenharmony_ci	uint32_t enterpriseNumber;	/* 140-143 */
9588c2ecf20Sopenharmony_ci
9598c2ecf20Sopenharmony_ci	uint32_t mtu;		/* 144-147 */
9608c2ecf20Sopenharmony_ci	uint32_t reserved0;	/* 148-14b */
9618c2ecf20Sopenharmony_ci	uint32_t crumbs2;	/* 14c-14f */
9628c2ecf20Sopenharmony_ci	uint8_t acSerialNumber[16];	/* 150-15f */
9638c2ecf20Sopenharmony_ci	uint32_t crumbs3;	/* 160-16f */
9648c2ecf20Sopenharmony_ci
9658c2ecf20Sopenharmony_ci	/* Leave this last in the struct so it is declared invalid if
9668c2ecf20Sopenharmony_ci	 * any new items are added.
9678c2ecf20Sopenharmony_ci	 */
9688c2ecf20Sopenharmony_ci	uint32_t reserved1[39]; /* 170-1ff */
9698c2ecf20Sopenharmony_ci};	/* 200 */
9708c2ecf20Sopenharmony_ci
9718c2ecf20Sopenharmony_cistruct mbx_sys_info {
9728c2ecf20Sopenharmony_ci	uint8_t board_id_str[16];   /*  0-f  Keep board ID string first */
9738c2ecf20Sopenharmony_ci				/* in this structure for GUI. */
9748c2ecf20Sopenharmony_ci	uint16_t board_id;	/* 10-11 board ID code */
9758c2ecf20Sopenharmony_ci	uint16_t phys_port_cnt;	/* 12-13 number of physical network ports */
9768c2ecf20Sopenharmony_ci	uint16_t port_num;	/* 14-15 network port for this PCI function */
9778c2ecf20Sopenharmony_ci				/* (port 0 is first port) */
9788c2ecf20Sopenharmony_ci	uint8_t mac_addr[6];	/* 16-1b MAC address for this PCI function */
9798c2ecf20Sopenharmony_ci	uint32_t iscsi_pci_func_cnt;  /* 1c-1f number of iSCSI PCI functions */
9808c2ecf20Sopenharmony_ci	uint32_t pci_func;	      /* 20-23 this PCI function */
9818c2ecf20Sopenharmony_ci	unsigned char serial_number[16];  /* 24-33 serial number string */
9828c2ecf20Sopenharmony_ci	uint8_t reserved[12];		  /* 34-3f */
9838c2ecf20Sopenharmony_ci};
9848c2ecf20Sopenharmony_ci
9858c2ecf20Sopenharmony_cistruct about_fw_info {
9868c2ecf20Sopenharmony_ci	uint16_t fw_major;		/* 00 - 01 */
9878c2ecf20Sopenharmony_ci	uint16_t fw_minor;		/* 02 - 03 */
9888c2ecf20Sopenharmony_ci	uint16_t fw_patch;		/* 04 - 05 */
9898c2ecf20Sopenharmony_ci	uint16_t fw_build;		/* 06 - 07 */
9908c2ecf20Sopenharmony_ci	uint8_t fw_build_date[16];	/* 08 - 17 ASCII String */
9918c2ecf20Sopenharmony_ci	uint8_t fw_build_time[16];	/* 18 - 27 ASCII String */
9928c2ecf20Sopenharmony_ci	uint8_t fw_build_user[16];	/* 28 - 37 ASCII String */
9938c2ecf20Sopenharmony_ci	uint16_t fw_load_source;	/* 38 - 39 */
9948c2ecf20Sopenharmony_ci					/* 1 = Flash Primary,
9958c2ecf20Sopenharmony_ci					   2 = Flash Secondary,
9968c2ecf20Sopenharmony_ci					   3 = Host Download
9978c2ecf20Sopenharmony_ci					*/
9988c2ecf20Sopenharmony_ci	uint8_t reserved1[6];		/* 3A - 3F */
9998c2ecf20Sopenharmony_ci	uint16_t iscsi_major;		/* 40 - 41 */
10008c2ecf20Sopenharmony_ci	uint16_t iscsi_minor;		/* 42 - 43 */
10018c2ecf20Sopenharmony_ci	uint16_t bootload_major;	/* 44 - 45 */
10028c2ecf20Sopenharmony_ci	uint16_t bootload_minor;	/* 46 - 47 */
10038c2ecf20Sopenharmony_ci	uint16_t bootload_patch;	/* 48 - 49 */
10048c2ecf20Sopenharmony_ci	uint16_t bootload_build;	/* 4A - 4B */
10058c2ecf20Sopenharmony_ci	uint8_t extended_timestamp[180];/* 4C - FF */
10068c2ecf20Sopenharmony_ci};
10078c2ecf20Sopenharmony_ci
10088c2ecf20Sopenharmony_cistruct crash_record {
10098c2ecf20Sopenharmony_ci	uint16_t fw_major_version;	/* 00 - 01 */
10108c2ecf20Sopenharmony_ci	uint16_t fw_minor_version;	/* 02 - 03 */
10118c2ecf20Sopenharmony_ci	uint16_t fw_patch_version;	/* 04 - 05 */
10128c2ecf20Sopenharmony_ci	uint16_t fw_build_version;	/* 06 - 07 */
10138c2ecf20Sopenharmony_ci
10148c2ecf20Sopenharmony_ci	uint8_t build_date[16]; /* 08 - 17 */
10158c2ecf20Sopenharmony_ci	uint8_t build_time[16]; /* 18 - 27 */
10168c2ecf20Sopenharmony_ci	uint8_t build_user[16]; /* 28 - 37 */
10178c2ecf20Sopenharmony_ci	uint8_t card_serial_num[16];	/* 38 - 47 */
10188c2ecf20Sopenharmony_ci
10198c2ecf20Sopenharmony_ci	uint32_t time_of_crash_in_secs; /* 48 - 4B */
10208c2ecf20Sopenharmony_ci	uint32_t time_of_crash_in_ms;	/* 4C - 4F */
10218c2ecf20Sopenharmony_ci
10228c2ecf20Sopenharmony_ci	uint16_t out_RISC_sd_num_frames;	/* 50 - 51 */
10238c2ecf20Sopenharmony_ci	uint16_t OAP_sd_num_words;	/* 52 - 53 */
10248c2ecf20Sopenharmony_ci	uint16_t IAP_sd_num_frames;	/* 54 - 55 */
10258c2ecf20Sopenharmony_ci	uint16_t in_RISC_sd_num_words;	/* 56 - 57 */
10268c2ecf20Sopenharmony_ci
10278c2ecf20Sopenharmony_ci	uint8_t reserved1[28];	/* 58 - 7F */
10288c2ecf20Sopenharmony_ci
10298c2ecf20Sopenharmony_ci	uint8_t out_RISC_reg_dump[256]; /* 80 -17F */
10308c2ecf20Sopenharmony_ci	uint8_t in_RISC_reg_dump[256];	/*180 -27F */
10318c2ecf20Sopenharmony_ci	uint8_t in_out_RISC_stack_dump[0];	/*280 - ??? */
10328c2ecf20Sopenharmony_ci};
10338c2ecf20Sopenharmony_ci
10348c2ecf20Sopenharmony_cistruct conn_event_log_entry {
10358c2ecf20Sopenharmony_ci#define MAX_CONN_EVENT_LOG_ENTRIES	100
10368c2ecf20Sopenharmony_ci	uint32_t timestamp_sec; /* 00 - 03 seconds since boot */
10378c2ecf20Sopenharmony_ci	uint32_t timestamp_ms;	/* 04 - 07 milliseconds since boot */
10388c2ecf20Sopenharmony_ci	uint16_t device_index;	/* 08 - 09  */
10398c2ecf20Sopenharmony_ci	uint16_t fw_conn_state; /* 0A - 0B  */
10408c2ecf20Sopenharmony_ci	uint8_t event_type;	/* 0C - 0C  */
10418c2ecf20Sopenharmony_ci	uint8_t error_code;	/* 0D - 0D  */
10428c2ecf20Sopenharmony_ci	uint16_t error_code_detail;	/* 0E - 0F  */
10438c2ecf20Sopenharmony_ci	uint8_t num_consecutive_events; /* 10 - 10  */
10448c2ecf20Sopenharmony_ci	uint8_t rsvd[3];	/* 11 - 13  */
10458c2ecf20Sopenharmony_ci};
10468c2ecf20Sopenharmony_ci
10478c2ecf20Sopenharmony_ci/*************************************************************************
10488c2ecf20Sopenharmony_ci *
10498c2ecf20Sopenharmony_ci *				IOCB Commands Structures and Definitions
10508c2ecf20Sopenharmony_ci *
10518c2ecf20Sopenharmony_ci *************************************************************************/
10528c2ecf20Sopenharmony_ci#define IOCB_MAX_CDB_LEN	    16	/* Bytes in a CBD */
10538c2ecf20Sopenharmony_ci#define IOCB_MAX_SENSEDATA_LEN	    32	/* Bytes of sense data */
10548c2ecf20Sopenharmony_ci#define IOCB_MAX_EXT_SENSEDATA_LEN  60  /* Bytes of extended sense data */
10558c2ecf20Sopenharmony_ci
10568c2ecf20Sopenharmony_ci/* IOCB header structure */
10578c2ecf20Sopenharmony_cistruct qla4_header {
10588c2ecf20Sopenharmony_ci	uint8_t entryType;
10598c2ecf20Sopenharmony_ci#define ET_STATUS		 0x03
10608c2ecf20Sopenharmony_ci#define ET_MARKER		 0x04
10618c2ecf20Sopenharmony_ci#define ET_CONT_T1		 0x0A
10628c2ecf20Sopenharmony_ci#define ET_STATUS_CONTINUATION	 0x10
10638c2ecf20Sopenharmony_ci#define ET_CMND_T3		 0x19
10648c2ecf20Sopenharmony_ci#define ET_PASSTHRU0		 0x3A
10658c2ecf20Sopenharmony_ci#define ET_PASSTHRU_STATUS	 0x3C
10668c2ecf20Sopenharmony_ci#define ET_MBOX_CMD		0x38
10678c2ecf20Sopenharmony_ci#define ET_MBOX_STATUS		0x39
10688c2ecf20Sopenharmony_ci
10698c2ecf20Sopenharmony_ci	uint8_t entryStatus;
10708c2ecf20Sopenharmony_ci	uint8_t systemDefined;
10718c2ecf20Sopenharmony_ci#define SD_ISCSI_PDU	0x01
10728c2ecf20Sopenharmony_ci	uint8_t entryCount;
10738c2ecf20Sopenharmony_ci
10748c2ecf20Sopenharmony_ci	/* SyetemDefined definition */
10758c2ecf20Sopenharmony_ci};
10768c2ecf20Sopenharmony_ci
10778c2ecf20Sopenharmony_ci/* Generic queue entry structure*/
10788c2ecf20Sopenharmony_cistruct queue_entry {
10798c2ecf20Sopenharmony_ci	uint8_t data[60];
10808c2ecf20Sopenharmony_ci	uint32_t signature;
10818c2ecf20Sopenharmony_ci
10828c2ecf20Sopenharmony_ci};
10838c2ecf20Sopenharmony_ci
10848c2ecf20Sopenharmony_ci/* 64 bit addressing segment counts*/
10858c2ecf20Sopenharmony_ci
10868c2ecf20Sopenharmony_ci#define COMMAND_SEG_A64	  1
10878c2ecf20Sopenharmony_ci#define CONTINUE_SEG_A64  5
10888c2ecf20Sopenharmony_ci
10898c2ecf20Sopenharmony_ci/* 64 bit addressing segment definition*/
10908c2ecf20Sopenharmony_ci
10918c2ecf20Sopenharmony_cistruct data_seg_a64 {
10928c2ecf20Sopenharmony_ci	struct {
10938c2ecf20Sopenharmony_ci		uint32_t addrLow;
10948c2ecf20Sopenharmony_ci		uint32_t addrHigh;
10958c2ecf20Sopenharmony_ci
10968c2ecf20Sopenharmony_ci	} base;
10978c2ecf20Sopenharmony_ci
10988c2ecf20Sopenharmony_ci	uint32_t count;
10998c2ecf20Sopenharmony_ci
11008c2ecf20Sopenharmony_ci};
11018c2ecf20Sopenharmony_ci
11028c2ecf20Sopenharmony_ci/* Command Type 3 entry structure*/
11038c2ecf20Sopenharmony_ci
11048c2ecf20Sopenharmony_cistruct command_t3_entry {
11058c2ecf20Sopenharmony_ci	struct qla4_header hdr;	/* 00-03 */
11068c2ecf20Sopenharmony_ci
11078c2ecf20Sopenharmony_ci	uint32_t handle;	/* 04-07 */
11088c2ecf20Sopenharmony_ci	uint16_t target;	/* 08-09 */
11098c2ecf20Sopenharmony_ci	uint16_t connection_id; /* 0A-0B */
11108c2ecf20Sopenharmony_ci
11118c2ecf20Sopenharmony_ci	uint8_t control_flags;	/* 0C */
11128c2ecf20Sopenharmony_ci
11138c2ecf20Sopenharmony_ci	/* data direction  (bits 5-6) */
11148c2ecf20Sopenharmony_ci#define CF_WRITE		0x20
11158c2ecf20Sopenharmony_ci#define CF_READ			0x40
11168c2ecf20Sopenharmony_ci#define CF_NO_DATA		0x00
11178c2ecf20Sopenharmony_ci
11188c2ecf20Sopenharmony_ci	/* task attributes (bits 2-0) */
11198c2ecf20Sopenharmony_ci#define CF_HEAD_TAG		0x03
11208c2ecf20Sopenharmony_ci#define CF_ORDERED_TAG		0x02
11218c2ecf20Sopenharmony_ci#define CF_SIMPLE_TAG		0x01
11228c2ecf20Sopenharmony_ci
11238c2ecf20Sopenharmony_ci	/* STATE FLAGS FIELD IS A PLACE HOLDER. THE FW WILL SET BITS
11248c2ecf20Sopenharmony_ci	 * IN THIS FIELD AS THE COMMAND IS PROCESSED. WHEN THE IOCB IS
11258c2ecf20Sopenharmony_ci	 * CHANGED TO AN IOSB THIS FIELD WILL HAVE THE STATE FLAGS SET
11268c2ecf20Sopenharmony_ci	 * PROPERLY.
11278c2ecf20Sopenharmony_ci	 */
11288c2ecf20Sopenharmony_ci	uint8_t state_flags;	/* 0D */
11298c2ecf20Sopenharmony_ci	uint8_t cmdRefNum;	/* 0E */
11308c2ecf20Sopenharmony_ci	uint8_t reserved1;	/* 0F */
11318c2ecf20Sopenharmony_ci	uint8_t cdb[IOCB_MAX_CDB_LEN];	/* 10-1F */
11328c2ecf20Sopenharmony_ci	struct scsi_lun lun;	/* FCP LUN (BE). */
11338c2ecf20Sopenharmony_ci	uint32_t cmdSeqNum;	/* 28-2B */
11348c2ecf20Sopenharmony_ci	uint16_t timeout;	/* 2C-2D */
11358c2ecf20Sopenharmony_ci	uint16_t dataSegCnt;	/* 2E-2F */
11368c2ecf20Sopenharmony_ci	uint32_t ttlByteCnt;	/* 30-33 */
11378c2ecf20Sopenharmony_ci	struct data_seg_a64 dataseg[COMMAND_SEG_A64];	/* 34-3F */
11388c2ecf20Sopenharmony_ci
11398c2ecf20Sopenharmony_ci};
11408c2ecf20Sopenharmony_ci
11418c2ecf20Sopenharmony_ci
11428c2ecf20Sopenharmony_ci/* Continuation Type 1 entry structure*/
11438c2ecf20Sopenharmony_cistruct continuation_t1_entry {
11448c2ecf20Sopenharmony_ci	struct qla4_header hdr;
11458c2ecf20Sopenharmony_ci
11468c2ecf20Sopenharmony_ci	struct data_seg_a64 dataseg[CONTINUE_SEG_A64];
11478c2ecf20Sopenharmony_ci
11488c2ecf20Sopenharmony_ci};
11498c2ecf20Sopenharmony_ci
11508c2ecf20Sopenharmony_ci/* Parameterize for 64 or 32 bits */
11518c2ecf20Sopenharmony_ci#define COMMAND_SEG	COMMAND_SEG_A64
11528c2ecf20Sopenharmony_ci#define CONTINUE_SEG	CONTINUE_SEG_A64
11538c2ecf20Sopenharmony_ci
11548c2ecf20Sopenharmony_ci#define ET_COMMAND	ET_CMND_T3
11558c2ecf20Sopenharmony_ci#define ET_CONTINUE	ET_CONT_T1
11568c2ecf20Sopenharmony_ci
11578c2ecf20Sopenharmony_ci/* Marker entry structure*/
11588c2ecf20Sopenharmony_cistruct qla4_marker_entry {
11598c2ecf20Sopenharmony_ci	struct qla4_header hdr;	/* 00-03 */
11608c2ecf20Sopenharmony_ci
11618c2ecf20Sopenharmony_ci	uint32_t system_defined; /* 04-07 */
11628c2ecf20Sopenharmony_ci	uint16_t target;	/* 08-09 */
11638c2ecf20Sopenharmony_ci	uint16_t modifier;	/* 0A-0B */
11648c2ecf20Sopenharmony_ci#define MM_LUN_RESET		0
11658c2ecf20Sopenharmony_ci#define MM_TGT_WARM_RESET	1
11668c2ecf20Sopenharmony_ci
11678c2ecf20Sopenharmony_ci	uint16_t flags;		/* 0C-0D */
11688c2ecf20Sopenharmony_ci	uint16_t reserved1;	/* 0E-0F */
11698c2ecf20Sopenharmony_ci	struct scsi_lun lun;	/* FCP LUN (BE). */
11708c2ecf20Sopenharmony_ci	uint64_t reserved2;	/* 18-1F */
11718c2ecf20Sopenharmony_ci	uint64_t reserved3;	/* 20-27 */
11728c2ecf20Sopenharmony_ci	uint64_t reserved4;	/* 28-2F */
11738c2ecf20Sopenharmony_ci	uint64_t reserved5;	/* 30-37 */
11748c2ecf20Sopenharmony_ci	uint64_t reserved6;	/* 38-3F */
11758c2ecf20Sopenharmony_ci};
11768c2ecf20Sopenharmony_ci
11778c2ecf20Sopenharmony_ci/* Status entry structure*/
11788c2ecf20Sopenharmony_cistruct status_entry {
11798c2ecf20Sopenharmony_ci	struct qla4_header hdr;	/* 00-03 */
11808c2ecf20Sopenharmony_ci
11818c2ecf20Sopenharmony_ci	uint32_t handle;	/* 04-07 */
11828c2ecf20Sopenharmony_ci
11838c2ecf20Sopenharmony_ci	uint8_t scsiStatus;	/* 08 */
11848c2ecf20Sopenharmony_ci#define SCSI_CHECK_CONDITION		  0x02
11858c2ecf20Sopenharmony_ci
11868c2ecf20Sopenharmony_ci	uint8_t iscsiFlags;	/* 09 */
11878c2ecf20Sopenharmony_ci#define ISCSI_FLAG_RESIDUAL_UNDER	  0x02
11888c2ecf20Sopenharmony_ci#define ISCSI_FLAG_RESIDUAL_OVER	  0x04
11898c2ecf20Sopenharmony_ci
11908c2ecf20Sopenharmony_ci	uint8_t iscsiResponse;	/* 0A */
11918c2ecf20Sopenharmony_ci
11928c2ecf20Sopenharmony_ci	uint8_t completionStatus;	/* 0B */
11938c2ecf20Sopenharmony_ci#define SCS_COMPLETE			  0x00
11948c2ecf20Sopenharmony_ci#define SCS_INCOMPLETE			  0x01
11958c2ecf20Sopenharmony_ci#define SCS_RESET_OCCURRED		  0x04
11968c2ecf20Sopenharmony_ci#define SCS_ABORTED			  0x05
11978c2ecf20Sopenharmony_ci#define SCS_TIMEOUT			  0x06
11988c2ecf20Sopenharmony_ci#define SCS_DATA_OVERRUN		  0x07
11998c2ecf20Sopenharmony_ci#define SCS_DATA_UNDERRUN		  0x15
12008c2ecf20Sopenharmony_ci#define SCS_QUEUE_FULL			  0x1C
12018c2ecf20Sopenharmony_ci#define SCS_DEVICE_UNAVAILABLE		  0x28
12028c2ecf20Sopenharmony_ci#define SCS_DEVICE_LOGGED_OUT		  0x29
12038c2ecf20Sopenharmony_ci
12048c2ecf20Sopenharmony_ci	uint8_t reserved1;	/* 0C */
12058c2ecf20Sopenharmony_ci
12068c2ecf20Sopenharmony_ci	/* state_flags MUST be at the same location as state_flags in
12078c2ecf20Sopenharmony_ci	 * the Command_T3/4_Entry */
12088c2ecf20Sopenharmony_ci	uint8_t state_flags;	/* 0D */
12098c2ecf20Sopenharmony_ci
12108c2ecf20Sopenharmony_ci	uint16_t senseDataByteCnt;	/* 0E-0F */
12118c2ecf20Sopenharmony_ci	uint32_t residualByteCnt;	/* 10-13 */
12128c2ecf20Sopenharmony_ci	uint32_t bidiResidualByteCnt;	/* 14-17 */
12138c2ecf20Sopenharmony_ci	uint32_t expSeqNum;	/* 18-1B */
12148c2ecf20Sopenharmony_ci	uint32_t maxCmdSeqNum;	/* 1C-1F */
12158c2ecf20Sopenharmony_ci	uint8_t senseData[IOCB_MAX_SENSEDATA_LEN];	/* 20-3F */
12168c2ecf20Sopenharmony_ci
12178c2ecf20Sopenharmony_ci};
12188c2ecf20Sopenharmony_ci
12198c2ecf20Sopenharmony_ci/* Status Continuation entry */
12208c2ecf20Sopenharmony_cistruct status_cont_entry {
12218c2ecf20Sopenharmony_ci       struct qla4_header hdr; /* 00-03 */
12228c2ecf20Sopenharmony_ci       uint8_t ext_sense_data[IOCB_MAX_EXT_SENSEDATA_LEN]; /* 04-63 */
12238c2ecf20Sopenharmony_ci};
12248c2ecf20Sopenharmony_ci
12258c2ecf20Sopenharmony_cistruct passthru0 {
12268c2ecf20Sopenharmony_ci	struct qla4_header hdr;		       /* 00-03 */
12278c2ecf20Sopenharmony_ci	uint32_t handle;	/* 04-07 */
12288c2ecf20Sopenharmony_ci	uint16_t target;	/* 08-09 */
12298c2ecf20Sopenharmony_ci	uint16_t connection_id;	/* 0A-0B */
12308c2ecf20Sopenharmony_ci#define ISNS_DEFAULT_SERVER_CONN_ID	((uint16_t)0x8000)
12318c2ecf20Sopenharmony_ci
12328c2ecf20Sopenharmony_ci	uint16_t control_flags;	/* 0C-0D */
12338c2ecf20Sopenharmony_ci#define PT_FLAG_ETHERNET_FRAME		0x8000
12348c2ecf20Sopenharmony_ci#define PT_FLAG_ISNS_PDU		0x8000
12358c2ecf20Sopenharmony_ci#define PT_FLAG_SEND_BUFFER		0x0200
12368c2ecf20Sopenharmony_ci#define PT_FLAG_WAIT_4_RESPONSE		0x0100
12378c2ecf20Sopenharmony_ci#define PT_FLAG_ISCSI_PDU		0x1000
12388c2ecf20Sopenharmony_ci
12398c2ecf20Sopenharmony_ci	uint16_t timeout;	/* 0E-0F */
12408c2ecf20Sopenharmony_ci#define PT_DEFAULT_TIMEOUT		30 /* seconds */
12418c2ecf20Sopenharmony_ci
12428c2ecf20Sopenharmony_ci	struct data_seg_a64 out_dsd;    /* 10-1B */
12438c2ecf20Sopenharmony_ci	uint32_t res1;		/* 1C-1F */
12448c2ecf20Sopenharmony_ci	struct data_seg_a64 in_dsd;     /* 20-2B */
12458c2ecf20Sopenharmony_ci	uint8_t res2[20];	/* 2C-3F */
12468c2ecf20Sopenharmony_ci};
12478c2ecf20Sopenharmony_ci
12488c2ecf20Sopenharmony_cistruct passthru_status {
12498c2ecf20Sopenharmony_ci	struct qla4_header hdr;		       /* 00-03 */
12508c2ecf20Sopenharmony_ci	uint32_t handle;	/* 04-07 */
12518c2ecf20Sopenharmony_ci	uint16_t target;	/* 08-09 */
12528c2ecf20Sopenharmony_ci	uint16_t connectionID;	/* 0A-0B */
12538c2ecf20Sopenharmony_ci
12548c2ecf20Sopenharmony_ci	uint8_t completionStatus;	/* 0C */
12558c2ecf20Sopenharmony_ci#define PASSTHRU_STATUS_COMPLETE		0x01
12568c2ecf20Sopenharmony_ci
12578c2ecf20Sopenharmony_ci	uint8_t residualFlags;	/* 0D */
12588c2ecf20Sopenharmony_ci
12598c2ecf20Sopenharmony_ci	uint16_t timeout;	/* 0E-0F */
12608c2ecf20Sopenharmony_ci	uint16_t portNumber;	/* 10-11 */
12618c2ecf20Sopenharmony_ci	uint8_t res1[10];	/* 12-1B */
12628c2ecf20Sopenharmony_ci	uint32_t outResidual;	/* 1C-1F */
12638c2ecf20Sopenharmony_ci	uint8_t res2[12];	/* 20-2B */
12648c2ecf20Sopenharmony_ci	uint32_t inResidual;	/* 2C-2F */
12658c2ecf20Sopenharmony_ci	uint8_t res4[16];	/* 30-3F */
12668c2ecf20Sopenharmony_ci};
12678c2ecf20Sopenharmony_ci
12688c2ecf20Sopenharmony_cistruct mbox_cmd_iocb {
12698c2ecf20Sopenharmony_ci	struct qla4_header hdr;	/* 00-03 */
12708c2ecf20Sopenharmony_ci	uint32_t handle;	/* 04-07 */
12718c2ecf20Sopenharmony_ci	uint32_t in_mbox[8];	/* 08-25 */
12728c2ecf20Sopenharmony_ci	uint32_t res1[6];	/* 26-3F */
12738c2ecf20Sopenharmony_ci};
12748c2ecf20Sopenharmony_ci
12758c2ecf20Sopenharmony_cistruct mbox_status_iocb {
12768c2ecf20Sopenharmony_ci	struct qla4_header hdr;	/* 00-03 */
12778c2ecf20Sopenharmony_ci	uint32_t handle;	/* 04-07 */
12788c2ecf20Sopenharmony_ci	uint32_t out_mbox[8];	/* 08-25 */
12798c2ecf20Sopenharmony_ci	uint32_t res1[6];	/* 26-3F */
12808c2ecf20Sopenharmony_ci};
12818c2ecf20Sopenharmony_ci
12828c2ecf20Sopenharmony_ci/*
12838c2ecf20Sopenharmony_ci * ISP queue - response queue entry definition.
12848c2ecf20Sopenharmony_ci */
12858c2ecf20Sopenharmony_cistruct response {
12868c2ecf20Sopenharmony_ci	uint8_t data[60];
12878c2ecf20Sopenharmony_ci	uint32_t signature;
12888c2ecf20Sopenharmony_ci#define RESPONSE_PROCESSED	0xDEADDEAD	/* Signature */
12898c2ecf20Sopenharmony_ci};
12908c2ecf20Sopenharmony_ci
12918c2ecf20Sopenharmony_cistruct ql_iscsi_stats {
12928c2ecf20Sopenharmony_ci	uint64_t mac_tx_frames; /* 0000–0007 */
12938c2ecf20Sopenharmony_ci	uint64_t mac_tx_bytes; /* 0008–000F */
12948c2ecf20Sopenharmony_ci	uint64_t mac_tx_multicast_frames; /* 0010–0017 */
12958c2ecf20Sopenharmony_ci	uint64_t mac_tx_broadcast_frames; /* 0018–001F */
12968c2ecf20Sopenharmony_ci	uint64_t mac_tx_pause_frames; /* 0020–0027 */
12978c2ecf20Sopenharmony_ci	uint64_t mac_tx_control_frames; /* 0028–002F */
12988c2ecf20Sopenharmony_ci	uint64_t mac_tx_deferral; /* 0030–0037 */
12998c2ecf20Sopenharmony_ci	uint64_t mac_tx_excess_deferral; /* 0038–003F */
13008c2ecf20Sopenharmony_ci	uint64_t mac_tx_late_collision; /* 0040–0047 */
13018c2ecf20Sopenharmony_ci	uint64_t mac_tx_abort; /* 0048–004F */
13028c2ecf20Sopenharmony_ci	uint64_t mac_tx_single_collision; /* 0050–0057 */
13038c2ecf20Sopenharmony_ci	uint64_t mac_tx_multiple_collision; /* 0058–005F */
13048c2ecf20Sopenharmony_ci	uint64_t mac_tx_collision; /* 0060–0067 */
13058c2ecf20Sopenharmony_ci	uint64_t mac_tx_frames_dropped; /* 0068–006F */
13068c2ecf20Sopenharmony_ci	uint64_t mac_tx_jumbo_frames; /* 0070–0077 */
13078c2ecf20Sopenharmony_ci	uint64_t mac_rx_frames; /* 0078–007F */
13088c2ecf20Sopenharmony_ci	uint64_t mac_rx_bytes; /* 0080–0087 */
13098c2ecf20Sopenharmony_ci	uint64_t mac_rx_unknown_control_frames; /* 0088–008F */
13108c2ecf20Sopenharmony_ci	uint64_t mac_rx_pause_frames; /* 0090–0097 */
13118c2ecf20Sopenharmony_ci	uint64_t mac_rx_control_frames; /* 0098–009F */
13128c2ecf20Sopenharmony_ci	uint64_t mac_rx_dribble; /* 00A0–00A7 */
13138c2ecf20Sopenharmony_ci	uint64_t mac_rx_frame_length_error; /* 00A8–00AF */
13148c2ecf20Sopenharmony_ci	uint64_t mac_rx_jabber; /* 00B0–00B7 */
13158c2ecf20Sopenharmony_ci	uint64_t mac_rx_carrier_sense_error; /* 00B8–00BF */
13168c2ecf20Sopenharmony_ci	uint64_t mac_rx_frame_discarded; /* 00C0–00C7 */
13178c2ecf20Sopenharmony_ci	uint64_t mac_rx_frames_dropped; /* 00C8–00CF */
13188c2ecf20Sopenharmony_ci	uint64_t mac_crc_error; /* 00D0–00D7 */
13198c2ecf20Sopenharmony_ci	uint64_t mac_encoding_error; /* 00D8–00DF */
13208c2ecf20Sopenharmony_ci	uint64_t mac_rx_length_error_large; /* 00E0–00E7 */
13218c2ecf20Sopenharmony_ci	uint64_t mac_rx_length_error_small; /* 00E8–00EF */
13228c2ecf20Sopenharmony_ci	uint64_t mac_rx_multicast_frames; /* 00F0–00F7 */
13238c2ecf20Sopenharmony_ci	uint64_t mac_rx_broadcast_frames; /* 00F8–00FF */
13248c2ecf20Sopenharmony_ci	uint64_t ip_tx_packets; /* 0100–0107 */
13258c2ecf20Sopenharmony_ci	uint64_t ip_tx_bytes; /* 0108–010F */
13268c2ecf20Sopenharmony_ci	uint64_t ip_tx_fragments; /* 0110–0117 */
13278c2ecf20Sopenharmony_ci	uint64_t ip_rx_packets; /* 0118–011F */
13288c2ecf20Sopenharmony_ci	uint64_t ip_rx_bytes; /* 0120–0127 */
13298c2ecf20Sopenharmony_ci	uint64_t ip_rx_fragments; /* 0128–012F */
13308c2ecf20Sopenharmony_ci	uint64_t ip_datagram_reassembly; /* 0130–0137 */
13318c2ecf20Sopenharmony_ci	uint64_t ip_invalid_address_error; /* 0138–013F */
13328c2ecf20Sopenharmony_ci	uint64_t ip_error_packets; /* 0140–0147 */
13338c2ecf20Sopenharmony_ci	uint64_t ip_fragrx_overlap; /* 0148–014F */
13348c2ecf20Sopenharmony_ci	uint64_t ip_fragrx_outoforder; /* 0150–0157 */
13358c2ecf20Sopenharmony_ci	uint64_t ip_datagram_reassembly_timeout; /* 0158–015F */
13368c2ecf20Sopenharmony_ci	uint64_t ipv6_tx_packets; /* 0160–0167 */
13378c2ecf20Sopenharmony_ci	uint64_t ipv6_tx_bytes; /* 0168–016F */
13388c2ecf20Sopenharmony_ci	uint64_t ipv6_tx_fragments; /* 0170–0177 */
13398c2ecf20Sopenharmony_ci	uint64_t ipv6_rx_packets; /* 0178–017F */
13408c2ecf20Sopenharmony_ci	uint64_t ipv6_rx_bytes; /* 0180–0187 */
13418c2ecf20Sopenharmony_ci	uint64_t ipv6_rx_fragments; /* 0188–018F */
13428c2ecf20Sopenharmony_ci	uint64_t ipv6_datagram_reassembly; /* 0190–0197 */
13438c2ecf20Sopenharmony_ci	uint64_t ipv6_invalid_address_error; /* 0198–019F */
13448c2ecf20Sopenharmony_ci	uint64_t ipv6_error_packets; /* 01A0–01A7 */
13458c2ecf20Sopenharmony_ci	uint64_t ipv6_fragrx_overlap; /* 01A8–01AF */
13468c2ecf20Sopenharmony_ci	uint64_t ipv6_fragrx_outoforder; /* 01B0–01B7 */
13478c2ecf20Sopenharmony_ci	uint64_t ipv6_datagram_reassembly_timeout; /* 01B8–01BF */
13488c2ecf20Sopenharmony_ci	uint64_t tcp_tx_segments; /* 01C0–01C7 */
13498c2ecf20Sopenharmony_ci	uint64_t tcp_tx_bytes; /* 01C8–01CF */
13508c2ecf20Sopenharmony_ci	uint64_t tcp_rx_segments; /* 01D0–01D7 */
13518c2ecf20Sopenharmony_ci	uint64_t tcp_rx_byte; /* 01D8–01DF */
13528c2ecf20Sopenharmony_ci	uint64_t tcp_duplicate_ack_retx; /* 01E0–01E7 */
13538c2ecf20Sopenharmony_ci	uint64_t tcp_retx_timer_expired; /* 01E8–01EF */
13548c2ecf20Sopenharmony_ci	uint64_t tcp_rx_duplicate_ack; /* 01F0–01F7 */
13558c2ecf20Sopenharmony_ci	uint64_t tcp_rx_pure_ackr; /* 01F8–01FF */
13568c2ecf20Sopenharmony_ci	uint64_t tcp_tx_delayed_ack; /* 0200–0207 */
13578c2ecf20Sopenharmony_ci	uint64_t tcp_tx_pure_ack; /* 0208–020F */
13588c2ecf20Sopenharmony_ci	uint64_t tcp_rx_segment_error; /* 0210–0217 */
13598c2ecf20Sopenharmony_ci	uint64_t tcp_rx_segment_outoforder; /* 0218–021F */
13608c2ecf20Sopenharmony_ci	uint64_t tcp_rx_window_probe; /* 0220–0227 */
13618c2ecf20Sopenharmony_ci	uint64_t tcp_rx_window_update; /* 0228–022F */
13628c2ecf20Sopenharmony_ci	uint64_t tcp_tx_window_probe_persist; /* 0230–0237 */
13638c2ecf20Sopenharmony_ci	uint64_t ecc_error_correction; /* 0238–023F */
13648c2ecf20Sopenharmony_ci	uint64_t iscsi_pdu_tx; /* 0240-0247 */
13658c2ecf20Sopenharmony_ci	uint64_t iscsi_data_bytes_tx; /* 0248-024F */
13668c2ecf20Sopenharmony_ci	uint64_t iscsi_pdu_rx; /* 0250-0257 */
13678c2ecf20Sopenharmony_ci	uint64_t iscsi_data_bytes_rx; /* 0258-025F */
13688c2ecf20Sopenharmony_ci	uint64_t iscsi_io_completed; /* 0260-0267 */
13698c2ecf20Sopenharmony_ci	uint64_t iscsi_unexpected_io_rx; /* 0268-026F */
13708c2ecf20Sopenharmony_ci	uint64_t iscsi_format_error; /* 0270-0277 */
13718c2ecf20Sopenharmony_ci	uint64_t iscsi_hdr_digest_error; /* 0278-027F */
13728c2ecf20Sopenharmony_ci	uint64_t iscsi_data_digest_error; /* 0280-0287 */
13738c2ecf20Sopenharmony_ci	uint64_t iscsi_sequence_error; /* 0288-028F */
13748c2ecf20Sopenharmony_ci	uint32_t tx_cmd_pdu; /* 0290-0293 */
13758c2ecf20Sopenharmony_ci	uint32_t tx_resp_pdu; /* 0294-0297 */
13768c2ecf20Sopenharmony_ci	uint32_t rx_cmd_pdu; /* 0298-029B */
13778c2ecf20Sopenharmony_ci	uint32_t rx_resp_pdu; /* 029C-029F */
13788c2ecf20Sopenharmony_ci
13798c2ecf20Sopenharmony_ci	uint64_t tx_data_octets; /* 02A0-02A7 */
13808c2ecf20Sopenharmony_ci	uint64_t rx_data_octets; /* 02A8-02AF */
13818c2ecf20Sopenharmony_ci
13828c2ecf20Sopenharmony_ci	uint32_t hdr_digest_err; /* 02B0–02B3 */
13838c2ecf20Sopenharmony_ci	uint32_t data_digest_err; /* 02B4–02B7 */
13848c2ecf20Sopenharmony_ci	uint32_t conn_timeout_err; /* 02B8–02BB */
13858c2ecf20Sopenharmony_ci	uint32_t framing_err; /* 02BC–02BF */
13868c2ecf20Sopenharmony_ci
13878c2ecf20Sopenharmony_ci	uint32_t tx_nopout_pdus; /* 02C0–02C3 */
13888c2ecf20Sopenharmony_ci	uint32_t tx_scsi_cmd_pdus;  /* 02C4–02C7 */
13898c2ecf20Sopenharmony_ci	uint32_t tx_tmf_cmd_pdus; /* 02C8–02CB */
13908c2ecf20Sopenharmony_ci	uint32_t tx_login_cmd_pdus; /* 02CC–02CF */
13918c2ecf20Sopenharmony_ci	uint32_t tx_text_cmd_pdus; /* 02D0–02D3 */
13928c2ecf20Sopenharmony_ci	uint32_t tx_scsi_write_pdus; /* 02D4–02D7 */
13938c2ecf20Sopenharmony_ci	uint32_t tx_logout_cmd_pdus; /* 02D8–02DB */
13948c2ecf20Sopenharmony_ci	uint32_t tx_snack_req_pdus; /* 02DC–02DF */
13958c2ecf20Sopenharmony_ci
13968c2ecf20Sopenharmony_ci	uint32_t rx_nopin_pdus; /* 02E0–02E3 */
13978c2ecf20Sopenharmony_ci	uint32_t rx_scsi_resp_pdus; /* 02E4–02E7 */
13988c2ecf20Sopenharmony_ci	uint32_t rx_tmf_resp_pdus; /* 02E8–02EB */
13998c2ecf20Sopenharmony_ci	uint32_t rx_login_resp_pdus; /* 02EC–02EF */
14008c2ecf20Sopenharmony_ci	uint32_t rx_text_resp_pdus; /* 02F0–02F3 */
14018c2ecf20Sopenharmony_ci	uint32_t rx_scsi_read_pdus; /* 02F4–02F7 */
14028c2ecf20Sopenharmony_ci	uint32_t rx_logout_resp_pdus; /* 02F8–02FB */
14038c2ecf20Sopenharmony_ci
14048c2ecf20Sopenharmony_ci	uint32_t rx_r2t_pdus; /* 02FC–02FF */
14058c2ecf20Sopenharmony_ci	uint32_t rx_async_pdus; /* 0300–0303 */
14068c2ecf20Sopenharmony_ci	uint32_t rx_reject_pdus; /* 0304–0307 */
14078c2ecf20Sopenharmony_ci
14088c2ecf20Sopenharmony_ci	uint8_t reserved2[264]; /* 0x0308 - 0x040F */
14098c2ecf20Sopenharmony_ci};
14108c2ecf20Sopenharmony_ci
14118c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_STATE_ARRAY_LEN		16
14128c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_CAP_SIZE_ARRAY_LEN		8
14138c2ecf20Sopenharmony_ci#define QLA8XXX_DBG_RSVD_ARRAY_LEN		8
14148c2ecf20Sopenharmony_ci#define QLA83XX_DBG_OCM_WNDREG_ARRAY_LEN	16
14158c2ecf20Sopenharmony_ci#define QLA83XX_SS_OCM_WNDREG_INDEX		3
14168c2ecf20Sopenharmony_ci#define QLA83XX_SS_PCI_INDEX			0
14178c2ecf20Sopenharmony_ci#define QLA8022_TEMPLATE_CAP_OFFSET		172
14188c2ecf20Sopenharmony_ci#define QLA83XX_TEMPLATE_CAP_OFFSET		268
14198c2ecf20Sopenharmony_ci#define QLA80XX_TEMPLATE_RESERVED_BITS		16
14208c2ecf20Sopenharmony_ci
14218c2ecf20Sopenharmony_cistruct qla4_8xxx_minidump_template_hdr {
14228c2ecf20Sopenharmony_ci	uint32_t entry_type;
14238c2ecf20Sopenharmony_ci	uint32_t first_entry_offset;
14248c2ecf20Sopenharmony_ci	uint32_t size_of_template;
14258c2ecf20Sopenharmony_ci	uint32_t capture_debug_level;
14268c2ecf20Sopenharmony_ci	uint32_t num_of_entries;
14278c2ecf20Sopenharmony_ci	uint32_t version;
14288c2ecf20Sopenharmony_ci	uint32_t driver_timestamp;
14298c2ecf20Sopenharmony_ci	uint32_t checksum;
14308c2ecf20Sopenharmony_ci
14318c2ecf20Sopenharmony_ci	uint32_t driver_capture_mask;
14328c2ecf20Sopenharmony_ci	uint32_t driver_info_word2;
14338c2ecf20Sopenharmony_ci	uint32_t driver_info_word3;
14348c2ecf20Sopenharmony_ci	uint32_t driver_info_word4;
14358c2ecf20Sopenharmony_ci
14368c2ecf20Sopenharmony_ci	uint32_t saved_state_array[QLA8XXX_DBG_STATE_ARRAY_LEN];
14378c2ecf20Sopenharmony_ci	uint32_t capture_size_array[QLA8XXX_DBG_CAP_SIZE_ARRAY_LEN];
14388c2ecf20Sopenharmony_ci	uint32_t ocm_window_reg[QLA83XX_DBG_OCM_WNDREG_ARRAY_LEN];
14398c2ecf20Sopenharmony_ci	uint32_t capabilities[QLA80XX_TEMPLATE_RESERVED_BITS];
14408c2ecf20Sopenharmony_ci};
14418c2ecf20Sopenharmony_ci
14428c2ecf20Sopenharmony_ci#endif /*  _QLA4X_FW_H */
1443