18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * QLogic Fibre Channel HBA Driver
48c2ecf20Sopenharmony_ci * Copyright (c)  2003-2014 QLogic Corporation
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef __QLA_FW_H
78c2ecf20Sopenharmony_ci#define __QLA_FW_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/nvme.h>
108c2ecf20Sopenharmony_ci#include <linux/nvme-fc.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include "qla_dsd.h"
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define MBS_CHECKSUM_ERROR	0x4010
158c2ecf20Sopenharmony_ci#define MBS_INVALID_PRODUCT_KEY	0x4020
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/*
188c2ecf20Sopenharmony_ci * Firmware Options.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci#define FO1_ENABLE_PUREX	BIT_10
218c2ecf20Sopenharmony_ci#define FO1_DISABLE_LED_CTRL	BIT_6
228c2ecf20Sopenharmony_ci#define FO1_ENABLE_8016		BIT_0
238c2ecf20Sopenharmony_ci#define FO2_ENABLE_SEL_CLASS2	BIT_5
248c2ecf20Sopenharmony_ci#define FO3_NO_ABTS_ON_LINKDOWN	BIT_14
258c2ecf20Sopenharmony_ci#define FO3_HOLD_STS_IOCB	BIT_12
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/*
288c2ecf20Sopenharmony_ci * Port Database structure definition for ISP 24xx.
298c2ecf20Sopenharmony_ci */
308c2ecf20Sopenharmony_ci#define PDO_FORCE_ADISC		BIT_1
318c2ecf20Sopenharmony_ci#define PDO_FORCE_PLOGI		BIT_0
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistruct buffer_credit_24xx {
348c2ecf20Sopenharmony_ci	u32 parameter[28];
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define	PORT_DATABASE_24XX_SIZE		64
388c2ecf20Sopenharmony_cistruct port_database_24xx {
398c2ecf20Sopenharmony_ci	uint16_t flags;
408c2ecf20Sopenharmony_ci#define PDF_TASK_RETRY_ID	BIT_14
418c2ecf20Sopenharmony_ci#define PDF_FC_TAPE		BIT_7
428c2ecf20Sopenharmony_ci#define PDF_ACK0_CAPABLE	BIT_6
438c2ecf20Sopenharmony_ci#define PDF_FCP2_CONF		BIT_5
448c2ecf20Sopenharmony_ci#define PDF_CLASS_2		BIT_4
458c2ecf20Sopenharmony_ci#define PDF_HARD_ADDR		BIT_1
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci	/*
488c2ecf20Sopenharmony_ci	 * for NVMe, the login_state field has been
498c2ecf20Sopenharmony_ci	 * split into nibbles.
508c2ecf20Sopenharmony_ci	 * The lower nibble is for FCP.
518c2ecf20Sopenharmony_ci	 * The upper nibble is for NVMe.
528c2ecf20Sopenharmony_ci	 */
538c2ecf20Sopenharmony_ci	uint8_t current_login_state;
548c2ecf20Sopenharmony_ci	uint8_t last_login_state;
558c2ecf20Sopenharmony_ci#define PDS_PLOGI_PENDING	0x03
568c2ecf20Sopenharmony_ci#define PDS_PLOGI_COMPLETE	0x04
578c2ecf20Sopenharmony_ci#define PDS_PRLI_PENDING	0x05
588c2ecf20Sopenharmony_ci#define PDS_PRLI_COMPLETE	0x06
598c2ecf20Sopenharmony_ci#define PDS_PORT_UNAVAILABLE	0x07
608c2ecf20Sopenharmony_ci#define PDS_PRLO_PENDING	0x09
618c2ecf20Sopenharmony_ci#define PDS_LOGO_PENDING	0x11
628c2ecf20Sopenharmony_ci#define PDS_PRLI2_PENDING	0x12
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci	uint8_t hard_address[3];
658c2ecf20Sopenharmony_ci	uint8_t reserved_1;
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci	uint8_t port_id[3];
688c2ecf20Sopenharmony_ci	uint8_t sequence_id;
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	uint16_t port_timer;
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	uint16_t nport_handle;			/* N_PORT handle. */
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci	uint16_t receive_data_size;
758c2ecf20Sopenharmony_ci	uint16_t reserved_2;
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci	uint8_t prli_svc_param_word_0[2];	/* Big endian */
788c2ecf20Sopenharmony_ci						/* Bits 15-0 of word 0 */
798c2ecf20Sopenharmony_ci	uint8_t prli_svc_param_word_3[2];	/* Big endian */
808c2ecf20Sopenharmony_ci						/* Bits 15-0 of word 3 */
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci	uint8_t port_name[WWN_SIZE];
838c2ecf20Sopenharmony_ci	uint8_t node_name[WWN_SIZE];
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci	uint8_t reserved_3[4];
868c2ecf20Sopenharmony_ci	uint16_t prli_nvme_svc_param_word_0;	/* Bits 15-0 of word 0 */
878c2ecf20Sopenharmony_ci	uint16_t prli_nvme_svc_param_word_3;	/* Bits 15-0 of word 3 */
888c2ecf20Sopenharmony_ci	uint16_t nvme_first_burst_size;
898c2ecf20Sopenharmony_ci	uint8_t reserved_4[14];
908c2ecf20Sopenharmony_ci};
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci/*
938c2ecf20Sopenharmony_ci * MB 75h returns a list of DB entries similar to port_database_24xx(64B).
948c2ecf20Sopenharmony_ci * However, in this case it returns 1st 40 bytes.
958c2ecf20Sopenharmony_ci */
968c2ecf20Sopenharmony_cistruct get_name_list_extended {
978c2ecf20Sopenharmony_ci	__le16 flags;
988c2ecf20Sopenharmony_ci	u8 current_login_state;
998c2ecf20Sopenharmony_ci	u8 last_login_state;
1008c2ecf20Sopenharmony_ci	u8 hard_address[3];
1018c2ecf20Sopenharmony_ci	u8 reserved_1;
1028c2ecf20Sopenharmony_ci	u8 port_id[3];
1038c2ecf20Sopenharmony_ci	u8 sequence_id;
1048c2ecf20Sopenharmony_ci	__le16 port_timer;
1058c2ecf20Sopenharmony_ci	__le16 nport_handle;			/* N_PORT handle. */
1068c2ecf20Sopenharmony_ci	__le16 receive_data_size;
1078c2ecf20Sopenharmony_ci	__le16 reserved_2;
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci	/* PRLI SVC Param are Big endian */
1108c2ecf20Sopenharmony_ci	u8 prli_svc_param_word_0[2]; /* Bits 15-0 of word 0 */
1118c2ecf20Sopenharmony_ci	u8 prli_svc_param_word_3[2]; /* Bits 15-0 of word 3 */
1128c2ecf20Sopenharmony_ci	u8 port_name[WWN_SIZE];
1138c2ecf20Sopenharmony_ci	u8 node_name[WWN_SIZE];
1148c2ecf20Sopenharmony_ci};
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/* MB 75h: This is the short version of the database */
1178c2ecf20Sopenharmony_cistruct get_name_list {
1188c2ecf20Sopenharmony_ci	u8 port_node_name[WWN_SIZE]; /* B7 most sig, B0 least sig */
1198c2ecf20Sopenharmony_ci	__le16 nport_handle;
1208c2ecf20Sopenharmony_ci	u8 reserved;
1218c2ecf20Sopenharmony_ci};
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_cistruct vp_database_24xx {
1248c2ecf20Sopenharmony_ci	uint16_t vp_status;
1258c2ecf20Sopenharmony_ci	uint8_t  options;
1268c2ecf20Sopenharmony_ci	uint8_t  id;
1278c2ecf20Sopenharmony_ci	uint8_t  port_name[WWN_SIZE];
1288c2ecf20Sopenharmony_ci	uint8_t  node_name[WWN_SIZE];
1298c2ecf20Sopenharmony_ci	uint16_t port_id_low;
1308c2ecf20Sopenharmony_ci	uint16_t port_id_high;
1318c2ecf20Sopenharmony_ci};
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_cistruct nvram_24xx {
1348c2ecf20Sopenharmony_ci	/* NVRAM header. */
1358c2ecf20Sopenharmony_ci	uint8_t id[4];
1368c2ecf20Sopenharmony_ci	__le16	nvram_version;
1378c2ecf20Sopenharmony_ci	uint16_t reserved_0;
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci	/* Firmware Initialization Control Block. */
1408c2ecf20Sopenharmony_ci	__le16	version;
1418c2ecf20Sopenharmony_ci	uint16_t reserved_1;
1428c2ecf20Sopenharmony_ci	__le16	frame_payload_size;
1438c2ecf20Sopenharmony_ci	__le16	execution_throttle;
1448c2ecf20Sopenharmony_ci	__le16	exchange_count;
1458c2ecf20Sopenharmony_ci	__le16	hard_address;
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci	uint8_t port_name[WWN_SIZE];
1488c2ecf20Sopenharmony_ci	uint8_t node_name[WWN_SIZE];
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci	__le16	login_retry_count;
1518c2ecf20Sopenharmony_ci	__le16	link_down_on_nos;
1528c2ecf20Sopenharmony_ci	__le16	interrupt_delay_timer;
1538c2ecf20Sopenharmony_ci	__le16	login_timeout;
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci	__le32	firmware_options_1;
1568c2ecf20Sopenharmony_ci	__le32	firmware_options_2;
1578c2ecf20Sopenharmony_ci	__le32	firmware_options_3;
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci	/* Offset 56. */
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci	/*
1628c2ecf20Sopenharmony_ci	 * BIT 0     = Control Enable
1638c2ecf20Sopenharmony_ci	 * BIT 1-15  =
1648c2ecf20Sopenharmony_ci	 *
1658c2ecf20Sopenharmony_ci	 * BIT 0-7   = Reserved
1668c2ecf20Sopenharmony_ci	 * BIT 8-10  = Output Swing 1G
1678c2ecf20Sopenharmony_ci	 * BIT 11-13 = Output Emphasis 1G
1688c2ecf20Sopenharmony_ci	 * BIT 14-15 = Reserved
1698c2ecf20Sopenharmony_ci	 *
1708c2ecf20Sopenharmony_ci	 * BIT 0-7   = Reserved
1718c2ecf20Sopenharmony_ci	 * BIT 8-10  = Output Swing 2G
1728c2ecf20Sopenharmony_ci	 * BIT 11-13 = Output Emphasis 2G
1738c2ecf20Sopenharmony_ci	 * BIT 14-15 = Reserved
1748c2ecf20Sopenharmony_ci	 *
1758c2ecf20Sopenharmony_ci	 * BIT 0-7   = Reserved
1768c2ecf20Sopenharmony_ci	 * BIT 8-10  = Output Swing 4G
1778c2ecf20Sopenharmony_ci	 * BIT 11-13 = Output Emphasis 4G
1788c2ecf20Sopenharmony_ci	 * BIT 14-15 = Reserved
1798c2ecf20Sopenharmony_ci	 */
1808c2ecf20Sopenharmony_ci	__le16	seriallink_options[4];
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci	uint16_t reserved_2[16];
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci	/* Offset 96. */
1858c2ecf20Sopenharmony_ci	uint16_t reserved_3[16];
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci	/* PCIe table entries. */
1888c2ecf20Sopenharmony_ci	uint16_t reserved_4[16];
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci	/* Offset 160. */
1918c2ecf20Sopenharmony_ci	uint16_t reserved_5[16];
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci	/* Offset 192. */
1948c2ecf20Sopenharmony_ci	uint16_t reserved_6[16];
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci	/* Offset 224. */
1978c2ecf20Sopenharmony_ci	uint16_t reserved_7[16];
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci	/*
2008c2ecf20Sopenharmony_ci	 * BIT 0  = Enable spinup delay
2018c2ecf20Sopenharmony_ci	 * BIT 1  = Disable BIOS
2028c2ecf20Sopenharmony_ci	 * BIT 2  = Enable Memory Map BIOS
2038c2ecf20Sopenharmony_ci	 * BIT 3  = Enable Selectable Boot
2048c2ecf20Sopenharmony_ci	 * BIT 4  = Disable RISC code load
2058c2ecf20Sopenharmony_ci	 * BIT 5  = Disable Serdes
2068c2ecf20Sopenharmony_ci	 * BIT 6  =
2078c2ecf20Sopenharmony_ci	 * BIT 7  =
2088c2ecf20Sopenharmony_ci	 *
2098c2ecf20Sopenharmony_ci	 * BIT 8  =
2108c2ecf20Sopenharmony_ci	 * BIT 9  =
2118c2ecf20Sopenharmony_ci	 * BIT 10 = Enable lip full login
2128c2ecf20Sopenharmony_ci	 * BIT 11 = Enable target reset
2138c2ecf20Sopenharmony_ci	 * BIT 12 =
2148c2ecf20Sopenharmony_ci	 * BIT 13 =
2158c2ecf20Sopenharmony_ci	 * BIT 14 =
2168c2ecf20Sopenharmony_ci	 * BIT 15 = Enable alternate WWN
2178c2ecf20Sopenharmony_ci	 *
2188c2ecf20Sopenharmony_ci	 * BIT 16-31 =
2198c2ecf20Sopenharmony_ci	 */
2208c2ecf20Sopenharmony_ci	__le32	host_p;
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci	uint8_t alternate_port_name[WWN_SIZE];
2238c2ecf20Sopenharmony_ci	uint8_t alternate_node_name[WWN_SIZE];
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci	uint8_t boot_port_name[WWN_SIZE];
2268c2ecf20Sopenharmony_ci	__le16	boot_lun_number;
2278c2ecf20Sopenharmony_ci	uint16_t reserved_8;
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci	uint8_t alt1_boot_port_name[WWN_SIZE];
2308c2ecf20Sopenharmony_ci	__le16	alt1_boot_lun_number;
2318c2ecf20Sopenharmony_ci	uint16_t reserved_9;
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci	uint8_t alt2_boot_port_name[WWN_SIZE];
2348c2ecf20Sopenharmony_ci	__le16	alt2_boot_lun_number;
2358c2ecf20Sopenharmony_ci	uint16_t reserved_10;
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci	uint8_t alt3_boot_port_name[WWN_SIZE];
2388c2ecf20Sopenharmony_ci	__le16	alt3_boot_lun_number;
2398c2ecf20Sopenharmony_ci	uint16_t reserved_11;
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci	/*
2428c2ecf20Sopenharmony_ci	 * BIT 0 = Selective Login
2438c2ecf20Sopenharmony_ci	 * BIT 1 = Alt-Boot Enable
2448c2ecf20Sopenharmony_ci	 * BIT 2 = Reserved
2458c2ecf20Sopenharmony_ci	 * BIT 3 = Boot Order List
2468c2ecf20Sopenharmony_ci	 * BIT 4 = Reserved
2478c2ecf20Sopenharmony_ci	 * BIT 5 = Selective LUN
2488c2ecf20Sopenharmony_ci	 * BIT 6 = Reserved
2498c2ecf20Sopenharmony_ci	 * BIT 7-31 =
2508c2ecf20Sopenharmony_ci	 */
2518c2ecf20Sopenharmony_ci	__le32	efi_parameters;
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci	uint8_t reset_delay;
2548c2ecf20Sopenharmony_ci	uint8_t reserved_12;
2558c2ecf20Sopenharmony_ci	uint16_t reserved_13;
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	__le16	boot_id_number;
2588c2ecf20Sopenharmony_ci	uint16_t reserved_14;
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci	__le16	max_luns_per_target;
2618c2ecf20Sopenharmony_ci	uint16_t reserved_15;
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci	__le16	port_down_retry_count;
2648c2ecf20Sopenharmony_ci	__le16	link_down_timeout;
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci	/* FCode parameters. */
2678c2ecf20Sopenharmony_ci	__le16	fcode_parameter;
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci	uint16_t reserved_16[3];
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci	/* Offset 352. */
2728c2ecf20Sopenharmony_ci	uint8_t prev_drv_ver_major;
2738c2ecf20Sopenharmony_ci	uint8_t prev_drv_ver_submajob;
2748c2ecf20Sopenharmony_ci	uint8_t prev_drv_ver_minor;
2758c2ecf20Sopenharmony_ci	uint8_t prev_drv_ver_subminor;
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci	__le16	prev_bios_ver_major;
2788c2ecf20Sopenharmony_ci	__le16	prev_bios_ver_minor;
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci	__le16	prev_efi_ver_major;
2818c2ecf20Sopenharmony_ci	__le16	prev_efi_ver_minor;
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci	__le16	prev_fw_ver_major;
2848c2ecf20Sopenharmony_ci	uint8_t prev_fw_ver_minor;
2858c2ecf20Sopenharmony_ci	uint8_t prev_fw_ver_subminor;
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci	uint16_t reserved_17[8];
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci	/* Offset 384. */
2908c2ecf20Sopenharmony_ci	uint16_t reserved_18[16];
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci	/* Offset 416. */
2938c2ecf20Sopenharmony_ci	uint16_t reserved_19[16];
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci	/* Offset 448. */
2968c2ecf20Sopenharmony_ci	uint16_t reserved_20[16];
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci	/* Offset 480. */
2998c2ecf20Sopenharmony_ci	uint8_t model_name[16];
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci	uint16_t reserved_21[2];
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci	/* Offset 500. */
3048c2ecf20Sopenharmony_ci	/* HW Parameter Block. */
3058c2ecf20Sopenharmony_ci	uint16_t pcie_table_sig;
3068c2ecf20Sopenharmony_ci	uint16_t pcie_table_offset;
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci	uint16_t subsystem_vendor_id;
3098c2ecf20Sopenharmony_ci	uint16_t subsystem_device_id;
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	__le32	checksum;
3128c2ecf20Sopenharmony_ci};
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ci/*
3158c2ecf20Sopenharmony_ci * ISP Initialization Control Block.
3168c2ecf20Sopenharmony_ci * Little endian except where noted.
3178c2ecf20Sopenharmony_ci */
3188c2ecf20Sopenharmony_ci#define	ICB_VERSION 1
3198c2ecf20Sopenharmony_cistruct init_cb_24xx {
3208c2ecf20Sopenharmony_ci	__le16	version;
3218c2ecf20Sopenharmony_ci	uint16_t reserved_1;
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci	__le16	frame_payload_size;
3248c2ecf20Sopenharmony_ci	__le16	execution_throttle;
3258c2ecf20Sopenharmony_ci	__le16	exchange_count;
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci	__le16	hard_address;
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci	uint8_t port_name[WWN_SIZE];		/* Big endian. */
3308c2ecf20Sopenharmony_ci	uint8_t node_name[WWN_SIZE];		/* Big endian. */
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci	__le16	response_q_inpointer;
3338c2ecf20Sopenharmony_ci	__le16	request_q_outpointer;
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci	__le16	login_retry_count;
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci	__le16	prio_request_q_outpointer;
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci	__le16	response_q_length;
3408c2ecf20Sopenharmony_ci	__le16	request_q_length;
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci	__le16	link_down_on_nos;		/* Milliseconds. */
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci	__le16	prio_request_q_length;
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci	__le64	 request_q_address __packed;
3478c2ecf20Sopenharmony_ci	__le64	 response_q_address __packed;
3488c2ecf20Sopenharmony_ci	__le64	 prio_request_q_address __packed;
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci	__le16	msix;
3518c2ecf20Sopenharmony_ci	__le16	msix_atio;
3528c2ecf20Sopenharmony_ci	uint8_t reserved_2[4];
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci	__le16	atio_q_inpointer;
3558c2ecf20Sopenharmony_ci	__le16	atio_q_length;
3568c2ecf20Sopenharmony_ci	__le64	atio_q_address __packed;
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci	__le16	interrupt_delay_timer;		/* 100us increments. */
3598c2ecf20Sopenharmony_ci	__le16	login_timeout;
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci	/*
3628c2ecf20Sopenharmony_ci	 * BIT 0  = Enable Hard Loop Id
3638c2ecf20Sopenharmony_ci	 * BIT 1  = Enable Fairness
3648c2ecf20Sopenharmony_ci	 * BIT 2  = Enable Full-Duplex
3658c2ecf20Sopenharmony_ci	 * BIT 3  = Reserved
3668c2ecf20Sopenharmony_ci	 * BIT 4  = Enable Target Mode
3678c2ecf20Sopenharmony_ci	 * BIT 5  = Disable Initiator Mode
3688c2ecf20Sopenharmony_ci	 * BIT 6  = Acquire FA-WWN
3698c2ecf20Sopenharmony_ci	 * BIT 7  = Enable D-port Diagnostics
3708c2ecf20Sopenharmony_ci	 *
3718c2ecf20Sopenharmony_ci	 * BIT 8  = Reserved
3728c2ecf20Sopenharmony_ci	 * BIT 9  = Non Participating LIP
3738c2ecf20Sopenharmony_ci	 * BIT 10 = Descending Loop ID Search
3748c2ecf20Sopenharmony_ci	 * BIT 11 = Acquire Loop ID in LIPA
3758c2ecf20Sopenharmony_ci	 * BIT 12 = Reserved
3768c2ecf20Sopenharmony_ci	 * BIT 13 = Full Login after LIP
3778c2ecf20Sopenharmony_ci	 * BIT 14 = Node Name Option
3788c2ecf20Sopenharmony_ci	 * BIT 15-31 = Reserved
3798c2ecf20Sopenharmony_ci	 */
3808c2ecf20Sopenharmony_ci	__le32	firmware_options_1;
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ci	/*
3838c2ecf20Sopenharmony_ci	 * BIT 0  = Operation Mode bit 0
3848c2ecf20Sopenharmony_ci	 * BIT 1  = Operation Mode bit 1
3858c2ecf20Sopenharmony_ci	 * BIT 2  = Operation Mode bit 2
3868c2ecf20Sopenharmony_ci	 * BIT 3  = Operation Mode bit 3
3878c2ecf20Sopenharmony_ci	 * BIT 4  = Connection Options bit 0
3888c2ecf20Sopenharmony_ci	 * BIT 5  = Connection Options bit 1
3898c2ecf20Sopenharmony_ci	 * BIT 6  = Connection Options bit 2
3908c2ecf20Sopenharmony_ci	 * BIT 7  = Enable Non part on LIHA failure
3918c2ecf20Sopenharmony_ci	 *
3928c2ecf20Sopenharmony_ci	 * BIT 8  = Enable Class 2
3938c2ecf20Sopenharmony_ci	 * BIT 9  = Enable ACK0
3948c2ecf20Sopenharmony_ci	 * BIT 10 = Reserved
3958c2ecf20Sopenharmony_ci	 * BIT 11 = Enable FC-SP Security
3968c2ecf20Sopenharmony_ci	 * BIT 12 = FC Tape Enable
3978c2ecf20Sopenharmony_ci	 * BIT 13 = Reserved
3988c2ecf20Sopenharmony_ci	 * BIT 14 = Enable Target PRLI Control
3998c2ecf20Sopenharmony_ci	 * BIT 15-31 = Reserved
4008c2ecf20Sopenharmony_ci	 */
4018c2ecf20Sopenharmony_ci	__le32	firmware_options_2;
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci	/*
4048c2ecf20Sopenharmony_ci	 * BIT 0  = Reserved
4058c2ecf20Sopenharmony_ci	 * BIT 1  = Soft ID only
4068c2ecf20Sopenharmony_ci	 * BIT 2  = Reserved
4078c2ecf20Sopenharmony_ci	 * BIT 3  = Reserved
4088c2ecf20Sopenharmony_ci	 * BIT 4  = FCP RSP Payload bit 0
4098c2ecf20Sopenharmony_ci	 * BIT 5  = FCP RSP Payload bit 1
4108c2ecf20Sopenharmony_ci	 * BIT 6  = Enable Receive Out-of-Order data frame handling
4118c2ecf20Sopenharmony_ci	 * BIT 7  = Disable Automatic PLOGI on Local Loop
4128c2ecf20Sopenharmony_ci	 *
4138c2ecf20Sopenharmony_ci	 * BIT 8  = Reserved
4148c2ecf20Sopenharmony_ci	 * BIT 9  = Enable Out-of-Order FCP_XFER_RDY relative offset handling
4158c2ecf20Sopenharmony_ci	 * BIT 10 = Reserved
4168c2ecf20Sopenharmony_ci	 * BIT 11 = Reserved
4178c2ecf20Sopenharmony_ci	 * BIT 12 = Reserved
4188c2ecf20Sopenharmony_ci	 * BIT 13 = Data Rate bit 0
4198c2ecf20Sopenharmony_ci	 * BIT 14 = Data Rate bit 1
4208c2ecf20Sopenharmony_ci	 * BIT 15 = Data Rate bit 2
4218c2ecf20Sopenharmony_ci	 * BIT 16 = Enable 75 ohm Termination Select
4228c2ecf20Sopenharmony_ci	 * BIT 17-28 = Reserved
4238c2ecf20Sopenharmony_ci	 * BIT 29 = Enable response queue 0 in index shadowing
4248c2ecf20Sopenharmony_ci	 * BIT 30 = Enable request queue 0 out index shadowing
4258c2ecf20Sopenharmony_ci	 * BIT 31 = Reserved
4268c2ecf20Sopenharmony_ci	 */
4278c2ecf20Sopenharmony_ci	__le32	firmware_options_3;
4288c2ecf20Sopenharmony_ci	__le16	 qos;
4298c2ecf20Sopenharmony_ci	__le16	 rid;
4308c2ecf20Sopenharmony_ci	uint8_t  reserved_3[20];
4318c2ecf20Sopenharmony_ci};
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci/*
4348c2ecf20Sopenharmony_ci * ISP queue - command entry structure definition.
4358c2ecf20Sopenharmony_ci */
4368c2ecf20Sopenharmony_ci#define COMMAND_BIDIRECTIONAL 0x75
4378c2ecf20Sopenharmony_cistruct cmd_bidir {
4388c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
4398c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
4408c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System defined */
4418c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry status. */
4428c2ecf20Sopenharmony_ci
4438c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* N_PORT handle. */
4468c2ecf20Sopenharmony_ci
4478c2ecf20Sopenharmony_ci	__le16	timeout;		/* Command timeout. */
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_ci	__le16	wr_dseg_count;		/* Write Data segment count. */
4508c2ecf20Sopenharmony_ci	__le16	rd_dseg_count;		/* Read Data segment count. */
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci	struct scsi_lun lun;		/* FCP LUN (BE). */
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ci	__le16	control_flags;		/* Control flags. */
4558c2ecf20Sopenharmony_ci#define BD_WRAP_BACK			BIT_3
4568c2ecf20Sopenharmony_ci#define BD_READ_DATA			BIT_1
4578c2ecf20Sopenharmony_ci#define BD_WRITE_DATA			BIT_0
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ci	__le16	fcp_cmnd_dseg_len;		/* Data segment length. */
4608c2ecf20Sopenharmony_ci	__le64	 fcp_cmnd_dseg_address __packed;/* Data segment address. */
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci	uint16_t reserved[2];			/* Reserved */
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_ci	__le32	rd_byte_count;			/* Total Byte count Read. */
4658c2ecf20Sopenharmony_ci	__le32	wr_byte_count;			/* Total Byte count write. */
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_ci	uint8_t port_id[3];			/* PortID of destination port.*/
4688c2ecf20Sopenharmony_ci	uint8_t vp_index;
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci	struct dsd64 fcp_dsd;
4718c2ecf20Sopenharmony_ci};
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci#define COMMAND_TYPE_6	0x48		/* Command Type 6 entry */
4748c2ecf20Sopenharmony_cistruct cmd_type_6 {
4758c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
4768c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
4778c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System defined. */
4788c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
4818c2ecf20Sopenharmony_ci
4828c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* N_PORT handle. */
4838c2ecf20Sopenharmony_ci	__le16	timeout;		/* Command timeout. */
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ci	__le16	dseg_count;		/* Data segment count. */
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_ci	__le16	fcp_rsp_dsd_len;	/* FCP_RSP DSD length. */
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci	struct scsi_lun lun;		/* FCP LUN (BE). */
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci	__le16	control_flags;		/* Control flags. */
4928c2ecf20Sopenharmony_ci#define CF_DIF_SEG_DESCR_ENABLE		BIT_3
4938c2ecf20Sopenharmony_ci#define CF_DATA_SEG_DESCR_ENABLE	BIT_2
4948c2ecf20Sopenharmony_ci#define CF_READ_DATA			BIT_1
4958c2ecf20Sopenharmony_ci#define CF_WRITE_DATA			BIT_0
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci	__le16	fcp_cmnd_dseg_len;	/* Data segment length. */
4988c2ecf20Sopenharmony_ci					/* Data segment address. */
4998c2ecf20Sopenharmony_ci	__le64	 fcp_cmnd_dseg_address __packed;
5008c2ecf20Sopenharmony_ci					/* Data segment address. */
5018c2ecf20Sopenharmony_ci	__le64	 fcp_rsp_dseg_address __packed;
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci	__le32	byte_count;		/* Total byte count. */
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_ci	uint8_t port_id[3];		/* PortID of destination port. */
5068c2ecf20Sopenharmony_ci	uint8_t vp_index;
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_ci	struct dsd64 fcp_dsd;
5098c2ecf20Sopenharmony_ci};
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_ci#define COMMAND_TYPE_7	0x18		/* Command Type 7 entry */
5128c2ecf20Sopenharmony_cistruct cmd_type_7 {
5138c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
5148c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
5158c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System defined. */
5168c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
5178c2ecf20Sopenharmony_ci
5188c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
5198c2ecf20Sopenharmony_ci
5208c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* N_PORT handle. */
5218c2ecf20Sopenharmony_ci	__le16	timeout;		/* Command timeout. */
5228c2ecf20Sopenharmony_ci#define FW_MAX_TIMEOUT		0x1999
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_ci	__le16	dseg_count;		/* Data segment count. */
5258c2ecf20Sopenharmony_ci	uint16_t reserved_1;
5268c2ecf20Sopenharmony_ci
5278c2ecf20Sopenharmony_ci	struct scsi_lun lun;		/* FCP LUN (BE). */
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_ci	__le16	task_mgmt_flags;	/* Task management flags. */
5308c2ecf20Sopenharmony_ci#define TMF_CLEAR_ACA		BIT_14
5318c2ecf20Sopenharmony_ci#define TMF_TARGET_RESET	BIT_13
5328c2ecf20Sopenharmony_ci#define TMF_LUN_RESET		BIT_12
5338c2ecf20Sopenharmony_ci#define TMF_CLEAR_TASK_SET	BIT_10
5348c2ecf20Sopenharmony_ci#define TMF_ABORT_TASK_SET	BIT_9
5358c2ecf20Sopenharmony_ci#define TMF_DSD_LIST_ENABLE	BIT_2
5368c2ecf20Sopenharmony_ci#define TMF_READ_DATA		BIT_1
5378c2ecf20Sopenharmony_ci#define TMF_WRITE_DATA		BIT_0
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci	uint8_t task;
5408c2ecf20Sopenharmony_ci#define TSK_SIMPLE		0
5418c2ecf20Sopenharmony_ci#define TSK_HEAD_OF_QUEUE	1
5428c2ecf20Sopenharmony_ci#define TSK_ORDERED		2
5438c2ecf20Sopenharmony_ci#define TSK_ACA			4
5448c2ecf20Sopenharmony_ci#define TSK_UNTAGGED		5
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_ci	uint8_t crn;
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci	uint8_t fcp_cdb[MAX_CMDSZ]; 	/* SCSI command words. */
5498c2ecf20Sopenharmony_ci	__le32	byte_count;		/* Total byte count. */
5508c2ecf20Sopenharmony_ci
5518c2ecf20Sopenharmony_ci	uint8_t port_id[3];		/* PortID of destination port. */
5528c2ecf20Sopenharmony_ci	uint8_t vp_index;
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci	struct dsd64 dsd;
5558c2ecf20Sopenharmony_ci};
5568c2ecf20Sopenharmony_ci
5578c2ecf20Sopenharmony_ci#define COMMAND_TYPE_CRC_2	0x6A	/* Command Type CRC_2 (Type 6)
5588c2ecf20Sopenharmony_ci					 * (T10-DIF) */
5598c2ecf20Sopenharmony_cistruct cmd_type_crc_2 {
5608c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
5618c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
5628c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System defined. */
5638c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
5668c2ecf20Sopenharmony_ci
5678c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* N_PORT handle. */
5688c2ecf20Sopenharmony_ci	__le16	timeout;		/* Command timeout. */
5698c2ecf20Sopenharmony_ci
5708c2ecf20Sopenharmony_ci	__le16	dseg_count;		/* Data segment count. */
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci	__le16	fcp_rsp_dseg_len;	/* FCP_RSP DSD length. */
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ci	struct scsi_lun lun;		/* FCP LUN (BE). */
5758c2ecf20Sopenharmony_ci
5768c2ecf20Sopenharmony_ci	__le16	control_flags;		/* Control flags. */
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci	__le16	fcp_cmnd_dseg_len;	/* Data segment length. */
5798c2ecf20Sopenharmony_ci	__le64	 fcp_cmnd_dseg_address __packed;
5808c2ecf20Sopenharmony_ci					/* Data segment address. */
5818c2ecf20Sopenharmony_ci	__le64	 fcp_rsp_dseg_address __packed;
5828c2ecf20Sopenharmony_ci
5838c2ecf20Sopenharmony_ci	__le32	byte_count;		/* Total byte count. */
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ci	uint8_t port_id[3];		/* PortID of destination port. */
5868c2ecf20Sopenharmony_ci	uint8_t vp_index;
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci	__le64	 crc_context_address __packed;	/* Data segment address. */
5898c2ecf20Sopenharmony_ci	__le16	crc_context_len;		/* Data segment length. */
5908c2ecf20Sopenharmony_ci	uint16_t reserved_1;			/* MUST be set to 0. */
5918c2ecf20Sopenharmony_ci};
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ci/*
5958c2ecf20Sopenharmony_ci * ISP queue - status entry structure definition.
5968c2ecf20Sopenharmony_ci */
5978c2ecf20Sopenharmony_ci#define	STATUS_TYPE	0x03		/* Status entry. */
5988c2ecf20Sopenharmony_cistruct sts_entry_24xx {
5998c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
6008c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
6018c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System defined. */
6028c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
6058c2ecf20Sopenharmony_ci
6068c2ecf20Sopenharmony_ci	__le16	comp_status;		/* Completion status. */
6078c2ecf20Sopenharmony_ci	__le16	ox_id;			/* OX_ID used by the firmware. */
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci	__le32	residual_len;		/* FW calc residual transfer length. */
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci	union {
6128c2ecf20Sopenharmony_ci		__le16 reserved_1;
6138c2ecf20Sopenharmony_ci		__le16	nvme_rsp_pyld_len;
6148c2ecf20Sopenharmony_ci	};
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_ci	__le16	state_flags;		/* State flags. */
6178c2ecf20Sopenharmony_ci#define SF_TRANSFERRED_DATA	BIT_11
6188c2ecf20Sopenharmony_ci#define SF_NVME_ERSP            BIT_6
6198c2ecf20Sopenharmony_ci#define SF_FCP_RSP_DMA		BIT_0
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci	__le16	status_qualifier;
6228c2ecf20Sopenharmony_ci	__le16	scsi_status;		/* SCSI status. */
6238c2ecf20Sopenharmony_ci#define SS_CONFIRMATION_REQ		BIT_12
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci	__le32	rsp_residual_count;	/* FCP RSP residual count. */
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci	__le32	sense_len;		/* FCP SENSE length. */
6288c2ecf20Sopenharmony_ci
6298c2ecf20Sopenharmony_ci	union {
6308c2ecf20Sopenharmony_ci		struct {
6318c2ecf20Sopenharmony_ci			__le32	rsp_data_len;	/* FCP response data length  */
6328c2ecf20Sopenharmony_ci			uint8_t data[28];	/* FCP rsp/sense information */
6338c2ecf20Sopenharmony_ci		};
6348c2ecf20Sopenharmony_ci		struct nvme_fc_ersp_iu nvme_ersp;
6358c2ecf20Sopenharmony_ci		uint8_t nvme_ersp_data[32];
6368c2ecf20Sopenharmony_ci	};
6378c2ecf20Sopenharmony_ci
6388c2ecf20Sopenharmony_ci	/*
6398c2ecf20Sopenharmony_ci	 * If DIF Error is set in comp_status, these additional fields are
6408c2ecf20Sopenharmony_ci	 * defined:
6418c2ecf20Sopenharmony_ci	 *
6428c2ecf20Sopenharmony_ci	 * !!! NOTE: Firmware sends expected/actual DIF data in big endian
6438c2ecf20Sopenharmony_ci	 * format; but all of the "data" field gets swab32-d in the beginning
6448c2ecf20Sopenharmony_ci	 * of qla2x00_status_entry().
6458c2ecf20Sopenharmony_ci	 *
6468c2ecf20Sopenharmony_ci	 * &data[10] : uint8_t report_runt_bg[2];	- computed guard
6478c2ecf20Sopenharmony_ci	 * &data[12] : uint8_t actual_dif[8];		- DIF Data received
6488c2ecf20Sopenharmony_ci	 * &data[20] : uint8_t expected_dif[8];		- DIF Data computed
6498c2ecf20Sopenharmony_ci	*/
6508c2ecf20Sopenharmony_ci};
6518c2ecf20Sopenharmony_ci
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ci/*
6548c2ecf20Sopenharmony_ci * Status entry completion status
6558c2ecf20Sopenharmony_ci */
6568c2ecf20Sopenharmony_ci#define CS_DATA_REASSEMBLY_ERROR 0x11	/* Data Reassembly Error.. */
6578c2ecf20Sopenharmony_ci#define CS_ABTS_BY_TARGET	0x13	/* Target send ABTS to abort IOCB. */
6588c2ecf20Sopenharmony_ci#define CS_FW_RESOURCE		0x2C	/* Firmware Resource Unavailable. */
6598c2ecf20Sopenharmony_ci#define CS_TASK_MGMT_OVERRUN	0x30	/* Task management overrun (8+). */
6608c2ecf20Sopenharmony_ci#define CS_ABORT_BY_TARGET	0x47	/* Abort By Target. */
6618c2ecf20Sopenharmony_ci
6628c2ecf20Sopenharmony_ci/*
6638c2ecf20Sopenharmony_ci * ISP queue - marker entry structure definition.
6648c2ecf20Sopenharmony_ci */
6658c2ecf20Sopenharmony_ci#define MARKER_TYPE	0x04		/* Marker entry. */
6668c2ecf20Sopenharmony_cistruct mrk_entry_24xx {
6678c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
6688c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
6698c2ecf20Sopenharmony_ci	uint8_t handle_count;		/* Handle count. */
6708c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
6718c2ecf20Sopenharmony_ci
6728c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
6738c2ecf20Sopenharmony_ci
6748c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* N_PORT handle. */
6758c2ecf20Sopenharmony_ci
6768c2ecf20Sopenharmony_ci	uint8_t modifier;		/* Modifier (7-0). */
6778c2ecf20Sopenharmony_ci#define MK_SYNC_ID_LUN	0		/* Synchronize ID/LUN */
6788c2ecf20Sopenharmony_ci#define MK_SYNC_ID	1		/* Synchronize ID */
6798c2ecf20Sopenharmony_ci#define MK_SYNC_ALL	2		/* Synchronize all ID/LUN */
6808c2ecf20Sopenharmony_ci	uint8_t reserved_1;
6818c2ecf20Sopenharmony_ci
6828c2ecf20Sopenharmony_ci	uint8_t reserved_2;
6838c2ecf20Sopenharmony_ci	uint8_t vp_index;
6848c2ecf20Sopenharmony_ci
6858c2ecf20Sopenharmony_ci	uint16_t reserved_3;
6868c2ecf20Sopenharmony_ci
6878c2ecf20Sopenharmony_ci	uint8_t lun[8];			/* FCP LUN (BE). */
6888c2ecf20Sopenharmony_ci	uint8_t reserved_4[40];
6898c2ecf20Sopenharmony_ci};
6908c2ecf20Sopenharmony_ci
6918c2ecf20Sopenharmony_ci/*
6928c2ecf20Sopenharmony_ci * ISP queue - CT Pass-Through entry structure definition.
6938c2ecf20Sopenharmony_ci */
6948c2ecf20Sopenharmony_ci#define CT_IOCB_TYPE		0x29	/* CT Pass-Through IOCB entry */
6958c2ecf20Sopenharmony_cistruct ct_entry_24xx {
6968c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
6978c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
6988c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System Defined. */
6998c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
7008c2ecf20Sopenharmony_ci
7018c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_ci	__le16	comp_status;		/* Completion status. */
7048c2ecf20Sopenharmony_ci
7058c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* N_PORT handle. */
7068c2ecf20Sopenharmony_ci
7078c2ecf20Sopenharmony_ci	__le16	cmd_dsd_count;
7088c2ecf20Sopenharmony_ci
7098c2ecf20Sopenharmony_ci	uint8_t vp_index;
7108c2ecf20Sopenharmony_ci	uint8_t reserved_1;
7118c2ecf20Sopenharmony_ci
7128c2ecf20Sopenharmony_ci	__le16	timeout;		/* Command timeout. */
7138c2ecf20Sopenharmony_ci	uint16_t reserved_2;
7148c2ecf20Sopenharmony_ci
7158c2ecf20Sopenharmony_ci	__le16	rsp_dsd_count;
7168c2ecf20Sopenharmony_ci
7178c2ecf20Sopenharmony_ci	uint8_t reserved_3[10];
7188c2ecf20Sopenharmony_ci
7198c2ecf20Sopenharmony_ci	__le32	rsp_byte_count;
7208c2ecf20Sopenharmony_ci	__le32	cmd_byte_count;
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci	struct dsd64 dsd[2];
7238c2ecf20Sopenharmony_ci};
7248c2ecf20Sopenharmony_ci
7258c2ecf20Sopenharmony_ci#define PURX_ELS_HEADER_SIZE	0x18
7268c2ecf20Sopenharmony_ci
7278c2ecf20Sopenharmony_ci/*
7288c2ecf20Sopenharmony_ci * ISP queue - PUREX IOCB entry structure definition
7298c2ecf20Sopenharmony_ci */
7308c2ecf20Sopenharmony_ci#define PUREX_IOCB_TYPE		0x51	/* CT Pass Through IOCB entry */
7318c2ecf20Sopenharmony_cistruct purex_entry_24xx {
7328c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
7338c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
7348c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System defined. */
7358c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_ci	__le16	reserved1;
7388c2ecf20Sopenharmony_ci	uint8_t vp_idx;
7398c2ecf20Sopenharmony_ci	uint8_t reserved2;
7408c2ecf20Sopenharmony_ci
7418c2ecf20Sopenharmony_ci	__le16	status_flags;
7428c2ecf20Sopenharmony_ci	__le16	nport_handle;
7438c2ecf20Sopenharmony_ci
7448c2ecf20Sopenharmony_ci	__le16	frame_size;
7458c2ecf20Sopenharmony_ci	__le16	trunc_frame_size;
7468c2ecf20Sopenharmony_ci
7478c2ecf20Sopenharmony_ci	__le32	rx_xchg_addr;
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci	uint8_t d_id[3];
7508c2ecf20Sopenharmony_ci	uint8_t r_ctl;
7518c2ecf20Sopenharmony_ci
7528c2ecf20Sopenharmony_ci	uint8_t s_id[3];
7538c2ecf20Sopenharmony_ci	uint8_t cs_ctl;
7548c2ecf20Sopenharmony_ci
7558c2ecf20Sopenharmony_ci	uint8_t f_ctl[3];
7568c2ecf20Sopenharmony_ci	uint8_t type;
7578c2ecf20Sopenharmony_ci
7588c2ecf20Sopenharmony_ci	__le16	seq_cnt;
7598c2ecf20Sopenharmony_ci	uint8_t df_ctl;
7608c2ecf20Sopenharmony_ci	uint8_t seq_id;
7618c2ecf20Sopenharmony_ci
7628c2ecf20Sopenharmony_ci	__le16	rx_id;
7638c2ecf20Sopenharmony_ci	__le16	ox_id;
7648c2ecf20Sopenharmony_ci	__le32	param;
7658c2ecf20Sopenharmony_ci
7668c2ecf20Sopenharmony_ci	uint8_t els_frame_payload[20];
7678c2ecf20Sopenharmony_ci};
7688c2ecf20Sopenharmony_ci
7698c2ecf20Sopenharmony_ci/*
7708c2ecf20Sopenharmony_ci * ISP queue - ELS Pass-Through entry structure definition.
7718c2ecf20Sopenharmony_ci */
7728c2ecf20Sopenharmony_ci#define ELS_IOCB_TYPE		0x53	/* ELS Pass-Through IOCB entry */
7738c2ecf20Sopenharmony_cistruct els_entry_24xx {
7748c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
7758c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
7768c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System Defined. */
7778c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
7788c2ecf20Sopenharmony_ci
7798c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
7808c2ecf20Sopenharmony_ci
7818c2ecf20Sopenharmony_ci	__le16	comp_status;		/* response only */
7828c2ecf20Sopenharmony_ci	__le16	nport_handle;
7838c2ecf20Sopenharmony_ci
7848c2ecf20Sopenharmony_ci	__le16	tx_dsd_count;
7858c2ecf20Sopenharmony_ci
7868c2ecf20Sopenharmony_ci	uint8_t vp_index;
7878c2ecf20Sopenharmony_ci	uint8_t sof_type;
7888c2ecf20Sopenharmony_ci#define EST_SOFI3		(1 << 4)
7898c2ecf20Sopenharmony_ci#define EST_SOFI2		(3 << 4)
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci	__le32	rx_xchg_address;	/* Receive exchange address. */
7928c2ecf20Sopenharmony_ci	__le16	rx_dsd_count;
7938c2ecf20Sopenharmony_ci
7948c2ecf20Sopenharmony_ci	uint8_t opcode;
7958c2ecf20Sopenharmony_ci	uint8_t reserved_2;
7968c2ecf20Sopenharmony_ci
7978c2ecf20Sopenharmony_ci	uint8_t d_id[3];
7988c2ecf20Sopenharmony_ci	uint8_t s_id[3];
7998c2ecf20Sopenharmony_ci
8008c2ecf20Sopenharmony_ci	__le16	control_flags;		/* Control flags. */
8018c2ecf20Sopenharmony_ci#define ECF_PAYLOAD_DESCR_MASK	(BIT_15|BIT_14|BIT_13)
8028c2ecf20Sopenharmony_ci#define EPD_ELS_COMMAND		(0 << 13)
8038c2ecf20Sopenharmony_ci#define EPD_ELS_ACC		(1 << 13)
8048c2ecf20Sopenharmony_ci#define EPD_ELS_RJT		(2 << 13)
8058c2ecf20Sopenharmony_ci#define EPD_RX_XCHG		(3 << 13)
8068c2ecf20Sopenharmony_ci#define ECF_CLR_PASSTHRU_PEND	BIT_12
8078c2ecf20Sopenharmony_ci#define ECF_INCL_FRAME_HDR	BIT_11
8088c2ecf20Sopenharmony_ci
8098c2ecf20Sopenharmony_ci	union {
8108c2ecf20Sopenharmony_ci		struct {
8118c2ecf20Sopenharmony_ci			__le32	 rx_byte_count;
8128c2ecf20Sopenharmony_ci			__le32	 tx_byte_count;
8138c2ecf20Sopenharmony_ci
8148c2ecf20Sopenharmony_ci			__le64	 tx_address __packed;	/* DSD 0 address. */
8158c2ecf20Sopenharmony_ci			__le32	 tx_len;		/* DSD 0 length. */
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ci			__le64	 rx_address __packed;	/* DSD 1 address. */
8188c2ecf20Sopenharmony_ci			__le32	 rx_len;		/* DSD 1 length. */
8198c2ecf20Sopenharmony_ci		};
8208c2ecf20Sopenharmony_ci		struct {
8218c2ecf20Sopenharmony_ci			__le32	total_byte_count;
8228c2ecf20Sopenharmony_ci			__le32	error_subcode_1;
8238c2ecf20Sopenharmony_ci			__le32	error_subcode_2;
8248c2ecf20Sopenharmony_ci			__le32	error_subcode_3;
8258c2ecf20Sopenharmony_ci		};
8268c2ecf20Sopenharmony_ci	};
8278c2ecf20Sopenharmony_ci};
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_cistruct els_sts_entry_24xx {
8308c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
8318c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
8328c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System Defined. */
8338c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
8348c2ecf20Sopenharmony_ci
8358c2ecf20Sopenharmony_ci	__le32	handle;		/* System handle. */
8368c2ecf20Sopenharmony_ci
8378c2ecf20Sopenharmony_ci	__le16	comp_status;
8388c2ecf20Sopenharmony_ci
8398c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* N_PORT handle. */
8408c2ecf20Sopenharmony_ci
8418c2ecf20Sopenharmony_ci	__le16	reserved_1;
8428c2ecf20Sopenharmony_ci
8438c2ecf20Sopenharmony_ci	uint8_t vp_index;
8448c2ecf20Sopenharmony_ci	uint8_t sof_type;
8458c2ecf20Sopenharmony_ci
8468c2ecf20Sopenharmony_ci	__le32	rx_xchg_address;	/* Receive exchange address. */
8478c2ecf20Sopenharmony_ci	__le16	reserved_2;
8488c2ecf20Sopenharmony_ci
8498c2ecf20Sopenharmony_ci	uint8_t opcode;
8508c2ecf20Sopenharmony_ci	uint8_t reserved_3;
8518c2ecf20Sopenharmony_ci
8528c2ecf20Sopenharmony_ci	uint8_t d_id[3];
8538c2ecf20Sopenharmony_ci	uint8_t s_id[3];
8548c2ecf20Sopenharmony_ci
8558c2ecf20Sopenharmony_ci	__le16	control_flags;		/* Control flags. */
8568c2ecf20Sopenharmony_ci	__le32	total_byte_count;
8578c2ecf20Sopenharmony_ci	__le32	error_subcode_1;
8588c2ecf20Sopenharmony_ci	__le32	error_subcode_2;
8598c2ecf20Sopenharmony_ci	__le32	error_subcode_3;
8608c2ecf20Sopenharmony_ci
8618c2ecf20Sopenharmony_ci	__le32	reserved_4[4];
8628c2ecf20Sopenharmony_ci};
8638c2ecf20Sopenharmony_ci/*
8648c2ecf20Sopenharmony_ci * ISP queue - Mailbox Command entry structure definition.
8658c2ecf20Sopenharmony_ci */
8668c2ecf20Sopenharmony_ci#define MBX_IOCB_TYPE	0x39
8678c2ecf20Sopenharmony_cistruct mbx_entry_24xx {
8688c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
8698c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
8708c2ecf20Sopenharmony_ci	uint8_t handle_count;		/* Handle count. */
8718c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
8728c2ecf20Sopenharmony_ci
8738c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
8748c2ecf20Sopenharmony_ci
8758c2ecf20Sopenharmony_ci	uint16_t mbx[28];
8768c2ecf20Sopenharmony_ci};
8778c2ecf20Sopenharmony_ci
8788c2ecf20Sopenharmony_ci
8798c2ecf20Sopenharmony_ci#define LOGINOUT_PORT_IOCB_TYPE	0x52	/* Login/Logout Port entry. */
8808c2ecf20Sopenharmony_cistruct logio_entry_24xx {
8818c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
8828c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
8838c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System defined. */
8848c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
8858c2ecf20Sopenharmony_ci
8868c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
8878c2ecf20Sopenharmony_ci
8888c2ecf20Sopenharmony_ci	__le16	comp_status;		/* Completion status. */
8898c2ecf20Sopenharmony_ci#define CS_LOGIO_ERROR		0x31	/* Login/Logout IOCB error. */
8908c2ecf20Sopenharmony_ci
8918c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* N_PORT handle. */
8928c2ecf20Sopenharmony_ci
8938c2ecf20Sopenharmony_ci	__le16	control_flags;		/* Control flags. */
8948c2ecf20Sopenharmony_ci					/* Modifiers. */
8958c2ecf20Sopenharmony_ci#define LCF_INCLUDE_SNS		BIT_10	/* Include SNS (FFFFFC) during LOGO. */
8968c2ecf20Sopenharmony_ci#define LCF_FCP2_OVERRIDE	BIT_9	/* Set/Reset word 3 of PRLI. */
8978c2ecf20Sopenharmony_ci#define LCF_CLASS_2		BIT_8	/* Enable class 2 during PLOGI. */
8988c2ecf20Sopenharmony_ci#define LCF_FREE_NPORT		BIT_7	/* Release NPORT handle after LOGO. */
8998c2ecf20Sopenharmony_ci#define LCF_EXPL_LOGO		BIT_6	/* Perform an explicit LOGO. */
9008c2ecf20Sopenharmony_ci#define LCF_NVME_PRLI		BIT_6   /* Perform NVME FC4 PRLI */
9018c2ecf20Sopenharmony_ci#define LCF_SKIP_PRLI		BIT_5	/* Skip PRLI after PLOGI. */
9028c2ecf20Sopenharmony_ci#define LCF_IMPL_LOGO_ALL	BIT_5	/* Implicit LOGO to all ports. */
9038c2ecf20Sopenharmony_ci#define LCF_COND_PLOGI		BIT_4	/* PLOGI only if not logged-in. */
9048c2ecf20Sopenharmony_ci#define LCF_IMPL_LOGO		BIT_4	/* Perform an implicit LOGO. */
9058c2ecf20Sopenharmony_ci#define LCF_IMPL_PRLO		BIT_4	/* Perform an implicit PRLO. */
9068c2ecf20Sopenharmony_ci					/* Commands. */
9078c2ecf20Sopenharmony_ci#define LCF_COMMAND_PLOGI	0x00	/* PLOGI. */
9088c2ecf20Sopenharmony_ci#define LCF_COMMAND_PRLI	0x01	/* PRLI. */
9098c2ecf20Sopenharmony_ci#define LCF_COMMAND_PDISC	0x02	/* PDISC. */
9108c2ecf20Sopenharmony_ci#define LCF_COMMAND_ADISC	0x03	/* ADISC. */
9118c2ecf20Sopenharmony_ci#define LCF_COMMAND_LOGO	0x08	/* LOGO. */
9128c2ecf20Sopenharmony_ci#define LCF_COMMAND_PRLO	0x09	/* PRLO. */
9138c2ecf20Sopenharmony_ci#define LCF_COMMAND_TPRLO	0x0A	/* TPRLO. */
9148c2ecf20Sopenharmony_ci
9158c2ecf20Sopenharmony_ci	uint8_t vp_index;
9168c2ecf20Sopenharmony_ci	uint8_t reserved_1;
9178c2ecf20Sopenharmony_ci
9188c2ecf20Sopenharmony_ci	uint8_t port_id[3];		/* PortID of destination port. */
9198c2ecf20Sopenharmony_ci
9208c2ecf20Sopenharmony_ci	uint8_t rsp_size;		/* Response size in 32bit words. */
9218c2ecf20Sopenharmony_ci
9228c2ecf20Sopenharmony_ci	__le32	io_parameter[11];	/* General I/O parameters. */
9238c2ecf20Sopenharmony_ci#define LSC_SCODE_NOLINK	0x01
9248c2ecf20Sopenharmony_ci#define LSC_SCODE_NOIOCB	0x02
9258c2ecf20Sopenharmony_ci#define LSC_SCODE_NOXCB		0x03
9268c2ecf20Sopenharmony_ci#define LSC_SCODE_CMD_FAILED	0x04
9278c2ecf20Sopenharmony_ci#define LSC_SCODE_NOFABRIC	0x05
9288c2ecf20Sopenharmony_ci#define LSC_SCODE_FW_NOT_READY	0x07
9298c2ecf20Sopenharmony_ci#define LSC_SCODE_NOT_LOGGED_IN	0x09
9308c2ecf20Sopenharmony_ci#define LSC_SCODE_NOPCB		0x0A
9318c2ecf20Sopenharmony_ci
9328c2ecf20Sopenharmony_ci#define LSC_SCODE_ELS_REJECT	0x18
9338c2ecf20Sopenharmony_ci#define LSC_SCODE_CMD_PARAM_ERR	0x19
9348c2ecf20Sopenharmony_ci#define LSC_SCODE_PORTID_USED	0x1A
9358c2ecf20Sopenharmony_ci#define LSC_SCODE_NPORT_USED	0x1B
9368c2ecf20Sopenharmony_ci#define LSC_SCODE_NONPORT	0x1C
9378c2ecf20Sopenharmony_ci#define LSC_SCODE_LOGGED_IN	0x1D
9388c2ecf20Sopenharmony_ci#define LSC_SCODE_NOFLOGI_ACC	0x1F
9398c2ecf20Sopenharmony_ci};
9408c2ecf20Sopenharmony_ci
9418c2ecf20Sopenharmony_ci#define TSK_MGMT_IOCB_TYPE	0x14
9428c2ecf20Sopenharmony_cistruct tsk_mgmt_entry {
9438c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
9448c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
9458c2ecf20Sopenharmony_ci	uint8_t handle_count;		/* Handle count. */
9468c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
9478c2ecf20Sopenharmony_ci
9488c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
9498c2ecf20Sopenharmony_ci
9508c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* N_PORT handle. */
9518c2ecf20Sopenharmony_ci
9528c2ecf20Sopenharmony_ci	uint16_t reserved_1;
9538c2ecf20Sopenharmony_ci
9548c2ecf20Sopenharmony_ci	__le16	delay;			/* Activity delay in seconds. */
9558c2ecf20Sopenharmony_ci
9568c2ecf20Sopenharmony_ci	__le16	timeout;		/* Command timeout. */
9578c2ecf20Sopenharmony_ci
9588c2ecf20Sopenharmony_ci	struct scsi_lun lun;		/* FCP LUN (BE). */
9598c2ecf20Sopenharmony_ci
9608c2ecf20Sopenharmony_ci	__le32	control_flags;		/* Control Flags. */
9618c2ecf20Sopenharmony_ci#define TCF_NOTMCMD_TO_TARGET	BIT_31
9628c2ecf20Sopenharmony_ci#define TCF_LUN_RESET		BIT_4
9638c2ecf20Sopenharmony_ci#define TCF_ABORT_TASK_SET	BIT_3
9648c2ecf20Sopenharmony_ci#define TCF_CLEAR_TASK_SET	BIT_2
9658c2ecf20Sopenharmony_ci#define TCF_TARGET_RESET	BIT_1
9668c2ecf20Sopenharmony_ci#define TCF_CLEAR_ACA		BIT_0
9678c2ecf20Sopenharmony_ci
9688c2ecf20Sopenharmony_ci	uint8_t reserved_2[20];
9698c2ecf20Sopenharmony_ci
9708c2ecf20Sopenharmony_ci	uint8_t port_id[3];		/* PortID of destination port. */
9718c2ecf20Sopenharmony_ci	uint8_t vp_index;
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_ci	uint8_t reserved_3[12];
9748c2ecf20Sopenharmony_ci};
9758c2ecf20Sopenharmony_ci
9768c2ecf20Sopenharmony_ci#define ABORT_IOCB_TYPE	0x33
9778c2ecf20Sopenharmony_cistruct abort_entry_24xx {
9788c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
9798c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
9808c2ecf20Sopenharmony_ci	uint8_t handle_count;		/* Handle count. */
9818c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
9828c2ecf20Sopenharmony_ci
9838c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
9848c2ecf20Sopenharmony_ci
9858c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* N_PORT handle. */
9868c2ecf20Sopenharmony_ci					/* or Completion status. */
9878c2ecf20Sopenharmony_ci
9888c2ecf20Sopenharmony_ci	__le16	options;		/* Options. */
9898c2ecf20Sopenharmony_ci#define AOF_NO_ABTS		BIT_0	/* Do not send any ABTS. */
9908c2ecf20Sopenharmony_ci
9918c2ecf20Sopenharmony_ci	uint32_t handle_to_abort;	/* System handle to abort. */
9928c2ecf20Sopenharmony_ci
9938c2ecf20Sopenharmony_ci	__le16	req_que_no;
9948c2ecf20Sopenharmony_ci	uint8_t reserved_1[30];
9958c2ecf20Sopenharmony_ci
9968c2ecf20Sopenharmony_ci	uint8_t port_id[3];		/* PortID of destination port. */
9978c2ecf20Sopenharmony_ci	uint8_t vp_index;
9988c2ecf20Sopenharmony_ci
9998c2ecf20Sopenharmony_ci	uint8_t reserved_2[12];
10008c2ecf20Sopenharmony_ci};
10018c2ecf20Sopenharmony_ci
10028c2ecf20Sopenharmony_ci#define ABTS_RCV_TYPE		0x54
10038c2ecf20Sopenharmony_ci#define ABTS_RSP_TYPE		0x55
10048c2ecf20Sopenharmony_cistruct abts_entry_24xx {
10058c2ecf20Sopenharmony_ci	uint8_t entry_type;
10068c2ecf20Sopenharmony_ci	uint8_t entry_count;
10078c2ecf20Sopenharmony_ci	uint8_t handle_count;
10088c2ecf20Sopenharmony_ci	uint8_t entry_status;
10098c2ecf20Sopenharmony_ci
10108c2ecf20Sopenharmony_ci	__le32	handle;		/* type 0x55 only */
10118c2ecf20Sopenharmony_ci
10128c2ecf20Sopenharmony_ci	__le16	comp_status;		/* type 0x55 only */
10138c2ecf20Sopenharmony_ci	__le16	nport_handle;		/* type 0x54 only */
10148c2ecf20Sopenharmony_ci
10158c2ecf20Sopenharmony_ci	__le16	control_flags;		/* type 0x55 only */
10168c2ecf20Sopenharmony_ci	uint8_t vp_idx;
10178c2ecf20Sopenharmony_ci	uint8_t sof_type;		/* sof_type is upper nibble */
10188c2ecf20Sopenharmony_ci
10198c2ecf20Sopenharmony_ci	__le32	rx_xch_addr;
10208c2ecf20Sopenharmony_ci
10218c2ecf20Sopenharmony_ci	uint8_t d_id[3];
10228c2ecf20Sopenharmony_ci	uint8_t r_ctl;
10238c2ecf20Sopenharmony_ci
10248c2ecf20Sopenharmony_ci	uint8_t s_id[3];
10258c2ecf20Sopenharmony_ci	uint8_t cs_ctl;
10268c2ecf20Sopenharmony_ci
10278c2ecf20Sopenharmony_ci	uint8_t f_ctl[3];
10288c2ecf20Sopenharmony_ci	uint8_t type;
10298c2ecf20Sopenharmony_ci
10308c2ecf20Sopenharmony_ci	__le16	seq_cnt;
10318c2ecf20Sopenharmony_ci	uint8_t df_ctl;
10328c2ecf20Sopenharmony_ci	uint8_t seq_id;
10338c2ecf20Sopenharmony_ci
10348c2ecf20Sopenharmony_ci	__le16	rx_id;
10358c2ecf20Sopenharmony_ci	__le16	ox_id;
10368c2ecf20Sopenharmony_ci
10378c2ecf20Sopenharmony_ci	__le32	param;
10388c2ecf20Sopenharmony_ci
10398c2ecf20Sopenharmony_ci	union {
10408c2ecf20Sopenharmony_ci		struct {
10418c2ecf20Sopenharmony_ci			__le32	subcode3;
10428c2ecf20Sopenharmony_ci			__le32	rsvd;
10438c2ecf20Sopenharmony_ci			__le32	subcode1;
10448c2ecf20Sopenharmony_ci			__le32	subcode2;
10458c2ecf20Sopenharmony_ci		} error;
10468c2ecf20Sopenharmony_ci		struct {
10478c2ecf20Sopenharmony_ci			__le16	rsrvd1;
10488c2ecf20Sopenharmony_ci			uint8_t last_seq_id;
10498c2ecf20Sopenharmony_ci			uint8_t seq_id_valid;
10508c2ecf20Sopenharmony_ci			__le16	aborted_rx_id;
10518c2ecf20Sopenharmony_ci			__le16	aborted_ox_id;
10528c2ecf20Sopenharmony_ci			__le16	high_seq_cnt;
10538c2ecf20Sopenharmony_ci			__le16	low_seq_cnt;
10548c2ecf20Sopenharmony_ci		} ba_acc;
10558c2ecf20Sopenharmony_ci		struct {
10568c2ecf20Sopenharmony_ci			uint8_t vendor_unique;
10578c2ecf20Sopenharmony_ci			uint8_t explanation;
10588c2ecf20Sopenharmony_ci			uint8_t reason;
10598c2ecf20Sopenharmony_ci		} ba_rjt;
10608c2ecf20Sopenharmony_ci	} payload;
10618c2ecf20Sopenharmony_ci
10628c2ecf20Sopenharmony_ci	__le32	rx_xch_addr_to_abort;
10638c2ecf20Sopenharmony_ci} __packed;
10648c2ecf20Sopenharmony_ci
10658c2ecf20Sopenharmony_ci/* ABTS payload explanation values */
10668c2ecf20Sopenharmony_ci#define BA_RJT_EXP_NO_ADDITIONAL	0
10678c2ecf20Sopenharmony_ci#define BA_RJT_EXP_INV_OX_RX_ID		3
10688c2ecf20Sopenharmony_ci#define BA_RJT_EXP_SEQ_ABORTED		5
10698c2ecf20Sopenharmony_ci
10708c2ecf20Sopenharmony_ci/* ABTS payload reason values */
10718c2ecf20Sopenharmony_ci#define BA_RJT_RSN_INV_CMD_CODE		1
10728c2ecf20Sopenharmony_ci#define BA_RJT_RSN_LOGICAL_ERROR	3
10738c2ecf20Sopenharmony_ci#define BA_RJT_RSN_LOGICAL_BUSY		5
10748c2ecf20Sopenharmony_ci#define BA_RJT_RSN_PROTOCOL_ERROR	7
10758c2ecf20Sopenharmony_ci#define BA_RJT_RSN_UNABLE_TO_PERFORM	9
10768c2ecf20Sopenharmony_ci#define BA_RJT_RSN_VENDOR_SPECIFIC	0xff
10778c2ecf20Sopenharmony_ci
10788c2ecf20Sopenharmony_ci/* FC_F values */
10798c2ecf20Sopenharmony_ci#define FC_TYPE_BLD		0x000		/* Basic link data */
10808c2ecf20Sopenharmony_ci#define FC_F_CTL_RSP_CNTXT	0x800000	/* Responder of exchange */
10818c2ecf20Sopenharmony_ci#define FC_F_CTL_LAST_SEQ	0x100000	/* Last sequence */
10828c2ecf20Sopenharmony_ci#define FC_F_CTL_END_SEQ	0x80000		/* Last sequence */
10838c2ecf20Sopenharmony_ci#define FC_F_CTL_SEQ_INIT	0x010000	/* Sequence initiative */
10848c2ecf20Sopenharmony_ci#define FC_ROUTING_BLD		0x80		/* Basic link data frame */
10858c2ecf20Sopenharmony_ci#define FC_R_CTL_BLD_BA_ACC	0x04		/* BA_ACC (basic accept) */
10868c2ecf20Sopenharmony_ci
10878c2ecf20Sopenharmony_ci/*
10888c2ecf20Sopenharmony_ci * ISP I/O Register Set structure definitions.
10898c2ecf20Sopenharmony_ci */
10908c2ecf20Sopenharmony_cistruct device_reg_24xx {
10918c2ecf20Sopenharmony_ci	__le32	flash_addr;		/* Flash/NVRAM BIOS address. */
10928c2ecf20Sopenharmony_ci#define FARX_DATA_FLAG	BIT_31
10938c2ecf20Sopenharmony_ci#define FARX_ACCESS_FLASH_CONF	0x7FFD0000
10948c2ecf20Sopenharmony_ci#define FARX_ACCESS_FLASH_DATA	0x7FF00000
10958c2ecf20Sopenharmony_ci#define FARX_ACCESS_NVRAM_CONF	0x7FFF0000
10968c2ecf20Sopenharmony_ci#define FARX_ACCESS_NVRAM_DATA	0x7FFE0000
10978c2ecf20Sopenharmony_ci
10988c2ecf20Sopenharmony_ci#define FA_NVRAM_FUNC0_ADDR	0x80
10998c2ecf20Sopenharmony_ci#define FA_NVRAM_FUNC1_ADDR	0x180
11008c2ecf20Sopenharmony_ci
11018c2ecf20Sopenharmony_ci#define FA_NVRAM_VPD_SIZE	0x200
11028c2ecf20Sopenharmony_ci#define FA_NVRAM_VPD0_ADDR	0x00
11038c2ecf20Sopenharmony_ci#define FA_NVRAM_VPD1_ADDR	0x100
11048c2ecf20Sopenharmony_ci
11058c2ecf20Sopenharmony_ci#define FA_BOOT_CODE_ADDR	0x00000
11068c2ecf20Sopenharmony_ci					/*
11078c2ecf20Sopenharmony_ci					 * RISC code begins at offset 512KB
11088c2ecf20Sopenharmony_ci					 * within flash. Consisting of two
11098c2ecf20Sopenharmony_ci					 * contiguous RISC code segments.
11108c2ecf20Sopenharmony_ci					 */
11118c2ecf20Sopenharmony_ci#define FA_RISC_CODE_ADDR	0x20000
11128c2ecf20Sopenharmony_ci#define FA_RISC_CODE_SEGMENTS	2
11138c2ecf20Sopenharmony_ci
11148c2ecf20Sopenharmony_ci#define FA_FLASH_DESCR_ADDR_24	0x11000
11158c2ecf20Sopenharmony_ci#define FA_FLASH_LAYOUT_ADDR_24	0x11400
11168c2ecf20Sopenharmony_ci#define FA_NPIV_CONF0_ADDR_24	0x16000
11178c2ecf20Sopenharmony_ci#define FA_NPIV_CONF1_ADDR_24	0x17000
11188c2ecf20Sopenharmony_ci
11198c2ecf20Sopenharmony_ci#define FA_FW_AREA_ADDR		0x40000
11208c2ecf20Sopenharmony_ci#define FA_VPD_NVRAM_ADDR	0x48000
11218c2ecf20Sopenharmony_ci#define FA_FEATURE_ADDR		0x4C000
11228c2ecf20Sopenharmony_ci#define FA_FLASH_DESCR_ADDR	0x50000
11238c2ecf20Sopenharmony_ci#define FA_FLASH_LAYOUT_ADDR	0x50400
11248c2ecf20Sopenharmony_ci#define FA_HW_EVENT0_ADDR	0x54000
11258c2ecf20Sopenharmony_ci#define FA_HW_EVENT1_ADDR	0x54400
11268c2ecf20Sopenharmony_ci#define FA_HW_EVENT_SIZE	0x200
11278c2ecf20Sopenharmony_ci#define FA_HW_EVENT_ENTRY_SIZE	4
11288c2ecf20Sopenharmony_ci#define FA_NPIV_CONF0_ADDR	0x5C000
11298c2ecf20Sopenharmony_ci#define FA_NPIV_CONF1_ADDR	0x5D000
11308c2ecf20Sopenharmony_ci#define FA_FCP_PRIO0_ADDR	0x10000
11318c2ecf20Sopenharmony_ci#define FA_FCP_PRIO1_ADDR	0x12000
11328c2ecf20Sopenharmony_ci
11338c2ecf20Sopenharmony_ci/*
11348c2ecf20Sopenharmony_ci * Flash Error Log Event Codes.
11358c2ecf20Sopenharmony_ci */
11368c2ecf20Sopenharmony_ci#define HW_EVENT_RESET_ERR	0xF00B
11378c2ecf20Sopenharmony_ci#define HW_EVENT_ISP_ERR	0xF020
11388c2ecf20Sopenharmony_ci#define HW_EVENT_PARITY_ERR	0xF022
11398c2ecf20Sopenharmony_ci#define HW_EVENT_NVRAM_CHKSUM_ERR	0xF023
11408c2ecf20Sopenharmony_ci#define HW_EVENT_FLASH_FW_ERR	0xF024
11418c2ecf20Sopenharmony_ci
11428c2ecf20Sopenharmony_ci	__le32	flash_data;		/* Flash/NVRAM BIOS data. */
11438c2ecf20Sopenharmony_ci
11448c2ecf20Sopenharmony_ci	__le32	ctrl_status;		/* Control/Status. */
11458c2ecf20Sopenharmony_ci#define CSRX_FLASH_ACCESS_ERROR	BIT_18	/* Flash/NVRAM Access Error. */
11468c2ecf20Sopenharmony_ci#define CSRX_DMA_ACTIVE		BIT_17	/* DMA Active status. */
11478c2ecf20Sopenharmony_ci#define CSRX_DMA_SHUTDOWN	BIT_16	/* DMA Shutdown control status. */
11488c2ecf20Sopenharmony_ci#define CSRX_FUNCTION		BIT_15	/* Function number. */
11498c2ecf20Sopenharmony_ci					/* PCI-X Bus Mode. */
11508c2ecf20Sopenharmony_ci#define CSRX_PCIX_BUS_MODE_MASK	(BIT_11|BIT_10|BIT_9|BIT_8)
11518c2ecf20Sopenharmony_ci#define PBM_PCI_33MHZ		(0 << 8)
11528c2ecf20Sopenharmony_ci#define PBM_PCIX_M1_66MHZ	(1 << 8)
11538c2ecf20Sopenharmony_ci#define PBM_PCIX_M1_100MHZ	(2 << 8)
11548c2ecf20Sopenharmony_ci#define PBM_PCIX_M1_133MHZ	(3 << 8)
11558c2ecf20Sopenharmony_ci#define PBM_PCIX_M2_66MHZ	(5 << 8)
11568c2ecf20Sopenharmony_ci#define PBM_PCIX_M2_100MHZ	(6 << 8)
11578c2ecf20Sopenharmony_ci#define PBM_PCIX_M2_133MHZ	(7 << 8)
11588c2ecf20Sopenharmony_ci#define PBM_PCI_66MHZ		(8 << 8)
11598c2ecf20Sopenharmony_ci					/* Max Write Burst byte count. */
11608c2ecf20Sopenharmony_ci#define CSRX_MAX_WRT_BURST_MASK	(BIT_5|BIT_4)
11618c2ecf20Sopenharmony_ci#define MWB_512_BYTES		(0 << 4)
11628c2ecf20Sopenharmony_ci#define MWB_1024_BYTES		(1 << 4)
11638c2ecf20Sopenharmony_ci#define MWB_2048_BYTES		(2 << 4)
11648c2ecf20Sopenharmony_ci#define MWB_4096_BYTES		(3 << 4)
11658c2ecf20Sopenharmony_ci
11668c2ecf20Sopenharmony_ci#define CSRX_64BIT_SLOT		BIT_2	/* PCI 64-Bit Bus Slot. */
11678c2ecf20Sopenharmony_ci#define CSRX_FLASH_ENABLE	BIT_1	/* Flash BIOS Read/Write enable. */
11688c2ecf20Sopenharmony_ci#define CSRX_ISP_SOFT_RESET	BIT_0	/* ISP soft reset. */
11698c2ecf20Sopenharmony_ci
11708c2ecf20Sopenharmony_ci	__le32	ictrl;			/* Interrupt control. */
11718c2ecf20Sopenharmony_ci#define ICRX_EN_RISC_INT	BIT_3	/* Enable RISC interrupts on PCI. */
11728c2ecf20Sopenharmony_ci
11738c2ecf20Sopenharmony_ci	__le32	istatus;		/* Interrupt status. */
11748c2ecf20Sopenharmony_ci#define ISRX_RISC_INT		BIT_3	/* RISC interrupt. */
11758c2ecf20Sopenharmony_ci
11768c2ecf20Sopenharmony_ci	__le32	unused_1[2];		/* Gap. */
11778c2ecf20Sopenharmony_ci
11788c2ecf20Sopenharmony_ci					/* Request Queue. */
11798c2ecf20Sopenharmony_ci	__le32	req_q_in;		/*  In-Pointer. */
11808c2ecf20Sopenharmony_ci	__le32	req_q_out;		/*  Out-Pointer. */
11818c2ecf20Sopenharmony_ci					/* Response Queue. */
11828c2ecf20Sopenharmony_ci	__le32	rsp_q_in;		/*  In-Pointer. */
11838c2ecf20Sopenharmony_ci	__le32	rsp_q_out;		/*  Out-Pointer. */
11848c2ecf20Sopenharmony_ci					/* Priority Request Queue. */
11858c2ecf20Sopenharmony_ci	__le32	preq_q_in;		/*  In-Pointer. */
11868c2ecf20Sopenharmony_ci	__le32	preq_q_out;		/*  Out-Pointer. */
11878c2ecf20Sopenharmony_ci
11888c2ecf20Sopenharmony_ci	__le32	unused_2[2];		/* Gap. */
11898c2ecf20Sopenharmony_ci
11908c2ecf20Sopenharmony_ci					/* ATIO Queue. */
11918c2ecf20Sopenharmony_ci	__le32	atio_q_in;		/*  In-Pointer. */
11928c2ecf20Sopenharmony_ci	__le32	atio_q_out;		/*  Out-Pointer. */
11938c2ecf20Sopenharmony_ci
11948c2ecf20Sopenharmony_ci	__le32	host_status;
11958c2ecf20Sopenharmony_ci#define HSRX_RISC_INT		BIT_15	/* RISC to Host interrupt. */
11968c2ecf20Sopenharmony_ci#define HSRX_RISC_PAUSED	BIT_8	/* RISC Paused. */
11978c2ecf20Sopenharmony_ci
11988c2ecf20Sopenharmony_ci	__le32	hccr;			/* Host command & control register. */
11998c2ecf20Sopenharmony_ci					/* HCCR statuses. */
12008c2ecf20Sopenharmony_ci#define HCCRX_HOST_INT		BIT_6	/* Host to RISC interrupt bit. */
12018c2ecf20Sopenharmony_ci#define HCCRX_RISC_RESET	BIT_5	/* RISC Reset mode bit. */
12028c2ecf20Sopenharmony_ci					/* HCCR commands. */
12038c2ecf20Sopenharmony_ci					/* NOOP. */
12048c2ecf20Sopenharmony_ci#define HCCRX_NOOP		0x00000000
12058c2ecf20Sopenharmony_ci					/* Set RISC Reset. */
12068c2ecf20Sopenharmony_ci#define HCCRX_SET_RISC_RESET	0x10000000
12078c2ecf20Sopenharmony_ci					/* Clear RISC Reset. */
12088c2ecf20Sopenharmony_ci#define HCCRX_CLR_RISC_RESET	0x20000000
12098c2ecf20Sopenharmony_ci					/* Set RISC Pause. */
12108c2ecf20Sopenharmony_ci#define HCCRX_SET_RISC_PAUSE	0x30000000
12118c2ecf20Sopenharmony_ci					/* Releases RISC Pause. */
12128c2ecf20Sopenharmony_ci#define HCCRX_REL_RISC_PAUSE	0x40000000
12138c2ecf20Sopenharmony_ci					/* Set HOST to RISC interrupt. */
12148c2ecf20Sopenharmony_ci#define HCCRX_SET_HOST_INT	0x50000000
12158c2ecf20Sopenharmony_ci					/* Clear HOST to RISC interrupt. */
12168c2ecf20Sopenharmony_ci#define HCCRX_CLR_HOST_INT	0x60000000
12178c2ecf20Sopenharmony_ci					/* Clear RISC to PCI interrupt. */
12188c2ecf20Sopenharmony_ci#define HCCRX_CLR_RISC_INT	0xA0000000
12198c2ecf20Sopenharmony_ci
12208c2ecf20Sopenharmony_ci	__le32	gpiod;			/* GPIO Data register. */
12218c2ecf20Sopenharmony_ci
12228c2ecf20Sopenharmony_ci					/* LED update mask. */
12238c2ecf20Sopenharmony_ci#define GPDX_LED_UPDATE_MASK	(BIT_20|BIT_19|BIT_18)
12248c2ecf20Sopenharmony_ci					/* Data update mask. */
12258c2ecf20Sopenharmony_ci#define GPDX_DATA_UPDATE_MASK	(BIT_17|BIT_16)
12268c2ecf20Sopenharmony_ci					/* Data update mask. */
12278c2ecf20Sopenharmony_ci#define GPDX_DATA_UPDATE_2_MASK	(BIT_28|BIT_27|BIT_26|BIT_17|BIT_16)
12288c2ecf20Sopenharmony_ci					/* LED control mask. */
12298c2ecf20Sopenharmony_ci#define GPDX_LED_COLOR_MASK	(BIT_4|BIT_3|BIT_2)
12308c2ecf20Sopenharmony_ci					/* LED bit values. Color names as
12318c2ecf20Sopenharmony_ci					 * referenced in fw spec.
12328c2ecf20Sopenharmony_ci					 */
12338c2ecf20Sopenharmony_ci#define GPDX_LED_YELLOW_ON	BIT_2
12348c2ecf20Sopenharmony_ci#define GPDX_LED_GREEN_ON	BIT_3
12358c2ecf20Sopenharmony_ci#define GPDX_LED_AMBER_ON	BIT_4
12368c2ecf20Sopenharmony_ci					/* Data in/out. */
12378c2ecf20Sopenharmony_ci#define GPDX_DATA_INOUT		(BIT_1|BIT_0)
12388c2ecf20Sopenharmony_ci
12398c2ecf20Sopenharmony_ci	__le32	gpioe;			/* GPIO Enable register. */
12408c2ecf20Sopenharmony_ci					/* Enable update mask. */
12418c2ecf20Sopenharmony_ci#define GPEX_ENABLE_UPDATE_MASK	(BIT_17|BIT_16)
12428c2ecf20Sopenharmony_ci					/* Enable update mask. */
12438c2ecf20Sopenharmony_ci#define GPEX_ENABLE_UPDATE_2_MASK (BIT_28|BIT_27|BIT_26|BIT_17|BIT_16)
12448c2ecf20Sopenharmony_ci					/* Enable. */
12458c2ecf20Sopenharmony_ci#define GPEX_ENABLE		(BIT_1|BIT_0)
12468c2ecf20Sopenharmony_ci
12478c2ecf20Sopenharmony_ci	__le32	iobase_addr;		/* I/O Bus Base Address register. */
12488c2ecf20Sopenharmony_ci
12498c2ecf20Sopenharmony_ci	__le32	unused_3[10];		/* Gap. */
12508c2ecf20Sopenharmony_ci
12518c2ecf20Sopenharmony_ci	__le16	mailbox0;
12528c2ecf20Sopenharmony_ci	__le16	mailbox1;
12538c2ecf20Sopenharmony_ci	__le16	mailbox2;
12548c2ecf20Sopenharmony_ci	__le16	mailbox3;
12558c2ecf20Sopenharmony_ci	__le16	mailbox4;
12568c2ecf20Sopenharmony_ci	__le16	mailbox5;
12578c2ecf20Sopenharmony_ci	__le16	mailbox6;
12588c2ecf20Sopenharmony_ci	__le16	mailbox7;
12598c2ecf20Sopenharmony_ci	__le16	mailbox8;
12608c2ecf20Sopenharmony_ci	__le16	mailbox9;
12618c2ecf20Sopenharmony_ci	__le16	mailbox10;
12628c2ecf20Sopenharmony_ci	__le16	mailbox11;
12638c2ecf20Sopenharmony_ci	__le16	mailbox12;
12648c2ecf20Sopenharmony_ci	__le16	mailbox13;
12658c2ecf20Sopenharmony_ci	__le16	mailbox14;
12668c2ecf20Sopenharmony_ci	__le16	mailbox15;
12678c2ecf20Sopenharmony_ci	__le16	mailbox16;
12688c2ecf20Sopenharmony_ci	__le16	mailbox17;
12698c2ecf20Sopenharmony_ci	__le16	mailbox18;
12708c2ecf20Sopenharmony_ci	__le16	mailbox19;
12718c2ecf20Sopenharmony_ci	__le16	mailbox20;
12728c2ecf20Sopenharmony_ci	__le16	mailbox21;
12738c2ecf20Sopenharmony_ci	__le16	mailbox22;
12748c2ecf20Sopenharmony_ci	__le16	mailbox23;
12758c2ecf20Sopenharmony_ci	__le16	mailbox24;
12768c2ecf20Sopenharmony_ci	__le16	mailbox25;
12778c2ecf20Sopenharmony_ci	__le16	mailbox26;
12788c2ecf20Sopenharmony_ci	__le16	mailbox27;
12798c2ecf20Sopenharmony_ci	__le16	mailbox28;
12808c2ecf20Sopenharmony_ci	__le16	mailbox29;
12818c2ecf20Sopenharmony_ci	__le16	mailbox30;
12828c2ecf20Sopenharmony_ci	__le16	mailbox31;
12838c2ecf20Sopenharmony_ci
12848c2ecf20Sopenharmony_ci	__le32	iobase_window;
12858c2ecf20Sopenharmony_ci	__le32	iobase_c4;
12868c2ecf20Sopenharmony_ci	__le32	iobase_c8;
12878c2ecf20Sopenharmony_ci	__le32	unused_4_1[6];		/* Gap. */
12888c2ecf20Sopenharmony_ci	__le32	iobase_q;
12898c2ecf20Sopenharmony_ci	__le32	unused_5[2];		/* Gap. */
12908c2ecf20Sopenharmony_ci	__le32	iobase_select;
12918c2ecf20Sopenharmony_ci	__le32	unused_6[2];		/* Gap. */
12928c2ecf20Sopenharmony_ci	__le32	iobase_sdata;
12938c2ecf20Sopenharmony_ci};
12948c2ecf20Sopenharmony_ci/* RISC-RISC semaphore register PCI offet */
12958c2ecf20Sopenharmony_ci#define RISC_REGISTER_BASE_OFFSET	0x7010
12968c2ecf20Sopenharmony_ci#define RISC_REGISTER_WINDOW_OFFSET	0x6
12978c2ecf20Sopenharmony_ci
12988c2ecf20Sopenharmony_ci/* RISC-RISC semaphore/flag register (risc address 0x7016) */
12998c2ecf20Sopenharmony_ci
13008c2ecf20Sopenharmony_ci#define RISC_SEMAPHORE		0x1UL
13018c2ecf20Sopenharmony_ci#define RISC_SEMAPHORE_WE	(RISC_SEMAPHORE << 16)
13028c2ecf20Sopenharmony_ci#define RISC_SEMAPHORE_CLR	(RISC_SEMAPHORE_WE | 0x0UL)
13038c2ecf20Sopenharmony_ci#define RISC_SEMAPHORE_SET	(RISC_SEMAPHORE_WE | RISC_SEMAPHORE)
13048c2ecf20Sopenharmony_ci
13058c2ecf20Sopenharmony_ci#define RISC_SEMAPHORE_FORCE		0x8000UL
13068c2ecf20Sopenharmony_ci#define RISC_SEMAPHORE_FORCE_WE		(RISC_SEMAPHORE_FORCE << 16)
13078c2ecf20Sopenharmony_ci#define RISC_SEMAPHORE_FORCE_CLR	(RISC_SEMAPHORE_FORCE_WE | 0x0UL)
13088c2ecf20Sopenharmony_ci#define RISC_SEMAPHORE_FORCE_SET	\
13098c2ecf20Sopenharmony_ci		(RISC_SEMAPHORE_FORCE_WE | RISC_SEMAPHORE_FORCE)
13108c2ecf20Sopenharmony_ci
13118c2ecf20Sopenharmony_ci/* RISC semaphore timeouts (ms) */
13128c2ecf20Sopenharmony_ci#define TIMEOUT_SEMAPHORE		2500
13138c2ecf20Sopenharmony_ci#define TIMEOUT_SEMAPHORE_FORCE		2000
13148c2ecf20Sopenharmony_ci#define TIMEOUT_TOTAL_ELAPSED		4500
13158c2ecf20Sopenharmony_ci
13168c2ecf20Sopenharmony_ci/* Trace Control *************************************************************/
13178c2ecf20Sopenharmony_ci
13188c2ecf20Sopenharmony_ci#define TC_AEN_DISABLE		0
13198c2ecf20Sopenharmony_ci
13208c2ecf20Sopenharmony_ci#define TC_EFT_ENABLE		4
13218c2ecf20Sopenharmony_ci#define TC_EFT_DISABLE		5
13228c2ecf20Sopenharmony_ci
13238c2ecf20Sopenharmony_ci#define TC_FCE_ENABLE		8
13248c2ecf20Sopenharmony_ci#define TC_FCE_OPTIONS		0
13258c2ecf20Sopenharmony_ci#define TC_FCE_DEFAULT_RX_SIZE	2112
13268c2ecf20Sopenharmony_ci#define TC_FCE_DEFAULT_TX_SIZE	2112
13278c2ecf20Sopenharmony_ci#define TC_FCE_DISABLE		9
13288c2ecf20Sopenharmony_ci#define TC_FCE_DISABLE_TRACE	BIT_0
13298c2ecf20Sopenharmony_ci
13308c2ecf20Sopenharmony_ci/* MID Support ***************************************************************/
13318c2ecf20Sopenharmony_ci
13328c2ecf20Sopenharmony_ci#define MIN_MULTI_ID_FABRIC	64	/* Must be power-of-2. */
13338c2ecf20Sopenharmony_ci#define MAX_MULTI_ID_FABRIC	256	/* ... */
13348c2ecf20Sopenharmony_ci
13358c2ecf20Sopenharmony_cistruct mid_conf_entry_24xx {
13368c2ecf20Sopenharmony_ci	uint16_t reserved_1;
13378c2ecf20Sopenharmony_ci
13388c2ecf20Sopenharmony_ci	/*
13398c2ecf20Sopenharmony_ci	 * BIT 0  = Enable Hard Loop Id
13408c2ecf20Sopenharmony_ci	 * BIT 1  = Acquire Loop ID in LIPA
13418c2ecf20Sopenharmony_ci	 * BIT 2  = ID not Acquired
13428c2ecf20Sopenharmony_ci	 * BIT 3  = Enable VP
13438c2ecf20Sopenharmony_ci	 * BIT 4  = Enable Initiator Mode
13448c2ecf20Sopenharmony_ci	 * BIT 5  = Disable Target Mode
13458c2ecf20Sopenharmony_ci	 * BIT 6-7 = Reserved
13468c2ecf20Sopenharmony_ci	 */
13478c2ecf20Sopenharmony_ci	uint8_t options;
13488c2ecf20Sopenharmony_ci
13498c2ecf20Sopenharmony_ci	uint8_t hard_address;
13508c2ecf20Sopenharmony_ci
13518c2ecf20Sopenharmony_ci	uint8_t port_name[WWN_SIZE];
13528c2ecf20Sopenharmony_ci	uint8_t node_name[WWN_SIZE];
13538c2ecf20Sopenharmony_ci};
13548c2ecf20Sopenharmony_ci
13558c2ecf20Sopenharmony_cistruct mid_init_cb_24xx {
13568c2ecf20Sopenharmony_ci	struct init_cb_24xx init_cb;
13578c2ecf20Sopenharmony_ci
13588c2ecf20Sopenharmony_ci	__le16	count;
13598c2ecf20Sopenharmony_ci	__le16	options;
13608c2ecf20Sopenharmony_ci
13618c2ecf20Sopenharmony_ci	struct mid_conf_entry_24xx entries[MAX_MULTI_ID_FABRIC];
13628c2ecf20Sopenharmony_ci};
13638c2ecf20Sopenharmony_ci
13648c2ecf20Sopenharmony_ci
13658c2ecf20Sopenharmony_cistruct mid_db_entry_24xx {
13668c2ecf20Sopenharmony_ci	uint16_t status;
13678c2ecf20Sopenharmony_ci#define MDBS_NON_PARTIC		BIT_3
13688c2ecf20Sopenharmony_ci#define MDBS_ID_ACQUIRED	BIT_1
13698c2ecf20Sopenharmony_ci#define MDBS_ENABLED		BIT_0
13708c2ecf20Sopenharmony_ci
13718c2ecf20Sopenharmony_ci	uint8_t options;
13728c2ecf20Sopenharmony_ci	uint8_t hard_address;
13738c2ecf20Sopenharmony_ci
13748c2ecf20Sopenharmony_ci	uint8_t port_name[WWN_SIZE];
13758c2ecf20Sopenharmony_ci	uint8_t node_name[WWN_SIZE];
13768c2ecf20Sopenharmony_ci
13778c2ecf20Sopenharmony_ci	uint8_t port_id[3];
13788c2ecf20Sopenharmony_ci	uint8_t reserved_1;
13798c2ecf20Sopenharmony_ci};
13808c2ecf20Sopenharmony_ci
13818c2ecf20Sopenharmony_ci/*
13828c2ecf20Sopenharmony_ci * Virtual Port Control IOCB
13838c2ecf20Sopenharmony_ci */
13848c2ecf20Sopenharmony_ci#define VP_CTRL_IOCB_TYPE	0x30	/* Virtual Port Control entry. */
13858c2ecf20Sopenharmony_cistruct vp_ctrl_entry_24xx {
13868c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
13878c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
13888c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System defined. */
13898c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
13908c2ecf20Sopenharmony_ci
13918c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
13928c2ecf20Sopenharmony_ci
13938c2ecf20Sopenharmony_ci	__le16	vp_idx_failed;
13948c2ecf20Sopenharmony_ci
13958c2ecf20Sopenharmony_ci	__le16	comp_status;		/* Completion status. */
13968c2ecf20Sopenharmony_ci#define CS_VCE_IOCB_ERROR       0x01    /* Error processing IOCB */
13978c2ecf20Sopenharmony_ci#define CS_VCE_ACQ_ID_ERROR	0x02	/* Error while acquireing ID. */
13988c2ecf20Sopenharmony_ci#define CS_VCE_BUSY		0x05	/* Firmware not ready to accept cmd. */
13998c2ecf20Sopenharmony_ci
14008c2ecf20Sopenharmony_ci	__le16	command;
14018c2ecf20Sopenharmony_ci#define VCE_COMMAND_ENABLE_VPS	0x00	/* Enable VPs. */
14028c2ecf20Sopenharmony_ci#define VCE_COMMAND_DISABLE_VPS	0x08	/* Disable VPs. */
14038c2ecf20Sopenharmony_ci#define VCE_COMMAND_DISABLE_VPS_REINIT	0x09 /* Disable VPs and reinit link. */
14048c2ecf20Sopenharmony_ci#define VCE_COMMAND_DISABLE_VPS_LOGO	0x0a /* Disable VPs and LOGO ports. */
14058c2ecf20Sopenharmony_ci#define VCE_COMMAND_DISABLE_VPS_LOGO_ALL        0x0b /* Disable VPs and LOGO ports. */
14068c2ecf20Sopenharmony_ci
14078c2ecf20Sopenharmony_ci	__le16	vp_count;
14088c2ecf20Sopenharmony_ci
14098c2ecf20Sopenharmony_ci	uint8_t vp_idx_map[16];
14108c2ecf20Sopenharmony_ci	__le16	flags;
14118c2ecf20Sopenharmony_ci	__le16	id;
14128c2ecf20Sopenharmony_ci	uint16_t reserved_4;
14138c2ecf20Sopenharmony_ci	__le16	hopct;
14148c2ecf20Sopenharmony_ci	uint8_t reserved_5[24];
14158c2ecf20Sopenharmony_ci};
14168c2ecf20Sopenharmony_ci
14178c2ecf20Sopenharmony_ci/*
14188c2ecf20Sopenharmony_ci * Modify Virtual Port Configuration IOCB
14198c2ecf20Sopenharmony_ci */
14208c2ecf20Sopenharmony_ci#define VP_CONFIG_IOCB_TYPE	0x31	/* Virtual Port Config entry. */
14218c2ecf20Sopenharmony_cistruct vp_config_entry_24xx {
14228c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
14238c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
14248c2ecf20Sopenharmony_ci	uint8_t handle_count;
14258c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
14268c2ecf20Sopenharmony_ci
14278c2ecf20Sopenharmony_ci	uint32_t handle;		/* System handle. */
14288c2ecf20Sopenharmony_ci
14298c2ecf20Sopenharmony_ci	__le16	flags;
14308c2ecf20Sopenharmony_ci#define CS_VF_BIND_VPORTS_TO_VF         BIT_0
14318c2ecf20Sopenharmony_ci#define CS_VF_SET_QOS_OF_VPORTS         BIT_1
14328c2ecf20Sopenharmony_ci#define CS_VF_SET_HOPS_OF_VPORTS        BIT_2
14338c2ecf20Sopenharmony_ci
14348c2ecf20Sopenharmony_ci	__le16	comp_status;		/* Completion status. */
14358c2ecf20Sopenharmony_ci#define CS_VCT_STS_ERROR	0x01	/* Specified VPs were not disabled. */
14368c2ecf20Sopenharmony_ci#define CS_VCT_CNT_ERROR	0x02	/* Invalid VP count. */
14378c2ecf20Sopenharmony_ci#define CS_VCT_ERROR		0x03	/* Unknown error. */
14388c2ecf20Sopenharmony_ci#define CS_VCT_IDX_ERROR	0x02	/* Invalid VP index. */
14398c2ecf20Sopenharmony_ci#define CS_VCT_BUSY		0x05	/* Firmware not ready to accept cmd. */
14408c2ecf20Sopenharmony_ci
14418c2ecf20Sopenharmony_ci	uint8_t command;
14428c2ecf20Sopenharmony_ci#define VCT_COMMAND_MOD_VPS     0x00    /* Modify VP configurations. */
14438c2ecf20Sopenharmony_ci#define VCT_COMMAND_MOD_ENABLE_VPS 0x01 /* Modify configuration & enable VPs. */
14448c2ecf20Sopenharmony_ci
14458c2ecf20Sopenharmony_ci	uint8_t vp_count;
14468c2ecf20Sopenharmony_ci
14478c2ecf20Sopenharmony_ci	uint8_t vp_index1;
14488c2ecf20Sopenharmony_ci	uint8_t vp_index2;
14498c2ecf20Sopenharmony_ci
14508c2ecf20Sopenharmony_ci	uint8_t options_idx1;
14518c2ecf20Sopenharmony_ci	uint8_t hard_address_idx1;
14528c2ecf20Sopenharmony_ci	uint16_t reserved_vp1;
14538c2ecf20Sopenharmony_ci	uint8_t port_name_idx1[WWN_SIZE];
14548c2ecf20Sopenharmony_ci	uint8_t node_name_idx1[WWN_SIZE];
14558c2ecf20Sopenharmony_ci
14568c2ecf20Sopenharmony_ci	uint8_t options_idx2;
14578c2ecf20Sopenharmony_ci	uint8_t hard_address_idx2;
14588c2ecf20Sopenharmony_ci	uint16_t reserved_vp2;
14598c2ecf20Sopenharmony_ci	uint8_t port_name_idx2[WWN_SIZE];
14608c2ecf20Sopenharmony_ci	uint8_t node_name_idx2[WWN_SIZE];
14618c2ecf20Sopenharmony_ci	__le16	id;
14628c2ecf20Sopenharmony_ci	uint16_t reserved_4;
14638c2ecf20Sopenharmony_ci	__le16	hopct;
14648c2ecf20Sopenharmony_ci	uint8_t reserved_5[2];
14658c2ecf20Sopenharmony_ci};
14668c2ecf20Sopenharmony_ci
14678c2ecf20Sopenharmony_ci#define VP_RPT_ID_IOCB_TYPE	0x32	/* Report ID Acquisition entry. */
14688c2ecf20Sopenharmony_cienum VP_STATUS {
14698c2ecf20Sopenharmony_ci	VP_STAT_COMPL,
14708c2ecf20Sopenharmony_ci	VP_STAT_FAIL,
14718c2ecf20Sopenharmony_ci	VP_STAT_ID_CHG,
14728c2ecf20Sopenharmony_ci	VP_STAT_SNS_TO,				/* timeout */
14738c2ecf20Sopenharmony_ci	VP_STAT_SNS_RJT,
14748c2ecf20Sopenharmony_ci	VP_STAT_SCR_TO,				/* timeout */
14758c2ecf20Sopenharmony_ci	VP_STAT_SCR_RJT,
14768c2ecf20Sopenharmony_ci};
14778c2ecf20Sopenharmony_ci
14788c2ecf20Sopenharmony_cienum VP_FLAGS {
14798c2ecf20Sopenharmony_ci	VP_FLAGS_CON_FLOOP = 1,
14808c2ecf20Sopenharmony_ci	VP_FLAGS_CON_P2P = 2,
14818c2ecf20Sopenharmony_ci	VP_FLAGS_CON_FABRIC = 3,
14828c2ecf20Sopenharmony_ci	VP_FLAGS_NAME_VALID = BIT_5,
14838c2ecf20Sopenharmony_ci};
14848c2ecf20Sopenharmony_ci
14858c2ecf20Sopenharmony_cistruct vp_rpt_id_entry_24xx {
14868c2ecf20Sopenharmony_ci	uint8_t entry_type;		/* Entry type. */
14878c2ecf20Sopenharmony_ci	uint8_t entry_count;		/* Entry count. */
14888c2ecf20Sopenharmony_ci	uint8_t sys_define;		/* System defined. */
14898c2ecf20Sopenharmony_ci	uint8_t entry_status;		/* Entry Status. */
14908c2ecf20Sopenharmony_ci	__le32 resv1;
14918c2ecf20Sopenharmony_ci	uint8_t vp_acquired;
14928c2ecf20Sopenharmony_ci	uint8_t vp_setup;
14938c2ecf20Sopenharmony_ci	uint8_t vp_idx;		/* Format 0=reserved */
14948c2ecf20Sopenharmony_ci	uint8_t vp_status;	/* Format 0=reserved */
14958c2ecf20Sopenharmony_ci
14968c2ecf20Sopenharmony_ci	uint8_t port_id[3];
14978c2ecf20Sopenharmony_ci	uint8_t format;
14988c2ecf20Sopenharmony_ci	union {
14998c2ecf20Sopenharmony_ci		struct _f0 {
15008c2ecf20Sopenharmony_ci			/* format 0 loop */
15018c2ecf20Sopenharmony_ci			uint8_t vp_idx_map[16];
15028c2ecf20Sopenharmony_ci			uint8_t reserved_4[32];
15038c2ecf20Sopenharmony_ci		} f0;
15048c2ecf20Sopenharmony_ci		struct _f1 {
15058c2ecf20Sopenharmony_ci			/* format 1 fabric */
15068c2ecf20Sopenharmony_ci			uint8_t vpstat1_subcode; /* vp_status=1 subcode */
15078c2ecf20Sopenharmony_ci			uint8_t flags;
15088c2ecf20Sopenharmony_ci#define TOPO_MASK  0xE
15098c2ecf20Sopenharmony_ci#define TOPO_FL    0x2
15108c2ecf20Sopenharmony_ci#define TOPO_N2N   0x4
15118c2ecf20Sopenharmony_ci#define TOPO_F     0x6
15128c2ecf20Sopenharmony_ci
15138c2ecf20Sopenharmony_ci			uint16_t fip_flags;
15148c2ecf20Sopenharmony_ci			uint8_t rsv2[12];
15158c2ecf20Sopenharmony_ci
15168c2ecf20Sopenharmony_ci			uint8_t ls_rjt_vendor;
15178c2ecf20Sopenharmony_ci			uint8_t ls_rjt_explanation;
15188c2ecf20Sopenharmony_ci			uint8_t ls_rjt_reason;
15198c2ecf20Sopenharmony_ci			uint8_t rsv3[5];
15208c2ecf20Sopenharmony_ci
15218c2ecf20Sopenharmony_ci			uint8_t port_name[8];
15228c2ecf20Sopenharmony_ci			uint8_t node_name[8];
15238c2ecf20Sopenharmony_ci			uint16_t bbcr;
15248c2ecf20Sopenharmony_ci			uint8_t reserved_5[6];
15258c2ecf20Sopenharmony_ci		} f1;
15268c2ecf20Sopenharmony_ci		struct _f2 { /* format 2: N2N direct connect */
15278c2ecf20Sopenharmony_ci			uint8_t vpstat1_subcode;
15288c2ecf20Sopenharmony_ci			uint8_t flags;
15298c2ecf20Sopenharmony_ci			uint16_t fip_flags;
15308c2ecf20Sopenharmony_ci			uint8_t rsv2[12];
15318c2ecf20Sopenharmony_ci
15328c2ecf20Sopenharmony_ci			uint8_t ls_rjt_vendor;
15338c2ecf20Sopenharmony_ci			uint8_t ls_rjt_explanation;
15348c2ecf20Sopenharmony_ci			uint8_t ls_rjt_reason;
15358c2ecf20Sopenharmony_ci			uint8_t rsv3[5];
15368c2ecf20Sopenharmony_ci
15378c2ecf20Sopenharmony_ci			uint8_t port_name[8];
15388c2ecf20Sopenharmony_ci			uint8_t node_name[8];
15398c2ecf20Sopenharmony_ci			uint16_t bbcr;
15408c2ecf20Sopenharmony_ci			uint8_t reserved_5[2];
15418c2ecf20Sopenharmony_ci			uint8_t remote_nport_id[4];
15428c2ecf20Sopenharmony_ci		} f2;
15438c2ecf20Sopenharmony_ci	} u;
15448c2ecf20Sopenharmony_ci};
15458c2ecf20Sopenharmony_ci
15468c2ecf20Sopenharmony_ci#define VF_EVFP_IOCB_TYPE       0x26    /* Exchange Virtual Fabric Parameters entry. */
15478c2ecf20Sopenharmony_cistruct vf_evfp_entry_24xx {
15488c2ecf20Sopenharmony_ci        uint8_t entry_type;             /* Entry type. */
15498c2ecf20Sopenharmony_ci        uint8_t entry_count;            /* Entry count. */
15508c2ecf20Sopenharmony_ci        uint8_t sys_define;             /* System defined. */
15518c2ecf20Sopenharmony_ci        uint8_t entry_status;           /* Entry Status. */
15528c2ecf20Sopenharmony_ci
15538c2ecf20Sopenharmony_ci        uint32_t handle;                /* System handle. */
15548c2ecf20Sopenharmony_ci        __le16	comp_status;           /* Completion status. */
15558c2ecf20Sopenharmony_ci        __le16	timeout;               /* timeout */
15568c2ecf20Sopenharmony_ci        __le16	adim_tagging_mode;
15578c2ecf20Sopenharmony_ci
15588c2ecf20Sopenharmony_ci        __le16	vfport_id;
15598c2ecf20Sopenharmony_ci        uint32_t exch_addr;
15608c2ecf20Sopenharmony_ci
15618c2ecf20Sopenharmony_ci        __le16	nport_handle;          /* N_PORT handle. */
15628c2ecf20Sopenharmony_ci        __le16	control_flags;
15638c2ecf20Sopenharmony_ci        uint32_t io_parameter_0;
15648c2ecf20Sopenharmony_ci        uint32_t io_parameter_1;
15658c2ecf20Sopenharmony_ci	__le64	 tx_address __packed;	/* Data segment 0 address. */
15668c2ecf20Sopenharmony_ci        uint32_t tx_len;                /* Data segment 0 length. */
15678c2ecf20Sopenharmony_ci	__le64	 rx_address __packed;	/* Data segment 1 address. */
15688c2ecf20Sopenharmony_ci        uint32_t rx_len;                /* Data segment 1 length. */
15698c2ecf20Sopenharmony_ci};
15708c2ecf20Sopenharmony_ci
15718c2ecf20Sopenharmony_ci/* END MID Support ***********************************************************/
15728c2ecf20Sopenharmony_ci
15738c2ecf20Sopenharmony_ci/* Flash Description Table ***************************************************/
15748c2ecf20Sopenharmony_ci
15758c2ecf20Sopenharmony_cistruct qla_fdt_layout {
15768c2ecf20Sopenharmony_ci	uint8_t sig[4];
15778c2ecf20Sopenharmony_ci	__le16	version;
15788c2ecf20Sopenharmony_ci	__le16	len;
15798c2ecf20Sopenharmony_ci	__le16	checksum;
15808c2ecf20Sopenharmony_ci	uint8_t unused1[2];
15818c2ecf20Sopenharmony_ci	uint8_t model[16];
15828c2ecf20Sopenharmony_ci	__le16	man_id;
15838c2ecf20Sopenharmony_ci	__le16	id;
15848c2ecf20Sopenharmony_ci	uint8_t flags;
15858c2ecf20Sopenharmony_ci	uint8_t erase_cmd;
15868c2ecf20Sopenharmony_ci	uint8_t alt_erase_cmd;
15878c2ecf20Sopenharmony_ci	uint8_t wrt_enable_cmd;
15888c2ecf20Sopenharmony_ci	uint8_t wrt_enable_bits;
15898c2ecf20Sopenharmony_ci	uint8_t wrt_sts_reg_cmd;
15908c2ecf20Sopenharmony_ci	uint8_t unprotect_sec_cmd;
15918c2ecf20Sopenharmony_ci	uint8_t read_man_id_cmd;
15928c2ecf20Sopenharmony_ci	__le32 block_size;
15938c2ecf20Sopenharmony_ci	__le32 alt_block_size;
15948c2ecf20Sopenharmony_ci	__le32 flash_size;
15958c2ecf20Sopenharmony_ci	__le32 wrt_enable_data;
15968c2ecf20Sopenharmony_ci	uint8_t read_id_addr_len;
15978c2ecf20Sopenharmony_ci	uint8_t wrt_disable_bits;
15988c2ecf20Sopenharmony_ci	uint8_t read_dev_id_len;
15998c2ecf20Sopenharmony_ci	uint8_t chip_erase_cmd;
16008c2ecf20Sopenharmony_ci	__le16	read_timeout;
16018c2ecf20Sopenharmony_ci	uint8_t protect_sec_cmd;
16028c2ecf20Sopenharmony_ci	uint8_t unused2[65];
16038c2ecf20Sopenharmony_ci};
16048c2ecf20Sopenharmony_ci
16058c2ecf20Sopenharmony_ci/* Flash Layout Table ********************************************************/
16068c2ecf20Sopenharmony_ci
16078c2ecf20Sopenharmony_cistruct qla_flt_location {
16088c2ecf20Sopenharmony_ci	uint8_t sig[4];
16098c2ecf20Sopenharmony_ci	__le16	start_lo;
16108c2ecf20Sopenharmony_ci	__le16	start_hi;
16118c2ecf20Sopenharmony_ci	uint8_t version;
16128c2ecf20Sopenharmony_ci	uint8_t unused[5];
16138c2ecf20Sopenharmony_ci	__le16	checksum;
16148c2ecf20Sopenharmony_ci};
16158c2ecf20Sopenharmony_ci
16168c2ecf20Sopenharmony_ci#define FLT_REG_FW		0x01
16178c2ecf20Sopenharmony_ci#define FLT_REG_BOOT_CODE	0x07
16188c2ecf20Sopenharmony_ci#define FLT_REG_VPD_0		0x14
16198c2ecf20Sopenharmony_ci#define FLT_REG_NVRAM_0		0x15
16208c2ecf20Sopenharmony_ci#define FLT_REG_VPD_1		0x16
16218c2ecf20Sopenharmony_ci#define FLT_REG_NVRAM_1		0x17
16228c2ecf20Sopenharmony_ci#define FLT_REG_VPD_2		0xD4
16238c2ecf20Sopenharmony_ci#define FLT_REG_NVRAM_2		0xD5
16248c2ecf20Sopenharmony_ci#define FLT_REG_VPD_3		0xD6
16258c2ecf20Sopenharmony_ci#define FLT_REG_NVRAM_3		0xD7
16268c2ecf20Sopenharmony_ci#define FLT_REG_FDT		0x1a
16278c2ecf20Sopenharmony_ci#define FLT_REG_FLT		0x1c
16288c2ecf20Sopenharmony_ci#define FLT_REG_HW_EVENT_0	0x1d
16298c2ecf20Sopenharmony_ci#define FLT_REG_HW_EVENT_1	0x1f
16308c2ecf20Sopenharmony_ci#define FLT_REG_NPIV_CONF_0	0x29
16318c2ecf20Sopenharmony_ci#define FLT_REG_NPIV_CONF_1	0x2a
16328c2ecf20Sopenharmony_ci#define FLT_REG_GOLD_FW		0x2f
16338c2ecf20Sopenharmony_ci#define FLT_REG_FCP_PRIO_0	0x87
16348c2ecf20Sopenharmony_ci#define FLT_REG_FCP_PRIO_1	0x88
16358c2ecf20Sopenharmony_ci#define FLT_REG_CNA_FW		0x97
16368c2ecf20Sopenharmony_ci#define FLT_REG_BOOT_CODE_8044	0xA2
16378c2ecf20Sopenharmony_ci#define FLT_REG_FCOE_FW		0xA4
16388c2ecf20Sopenharmony_ci#define FLT_REG_FCOE_NVRAM_0	0xAA
16398c2ecf20Sopenharmony_ci#define FLT_REG_FCOE_NVRAM_1	0xAC
16408c2ecf20Sopenharmony_ci
16418c2ecf20Sopenharmony_ci/* 27xx */
16428c2ecf20Sopenharmony_ci#define FLT_REG_IMG_PRI_27XX	0x95
16438c2ecf20Sopenharmony_ci#define FLT_REG_IMG_SEC_27XX	0x96
16448c2ecf20Sopenharmony_ci#define FLT_REG_FW_SEC_27XX	0x02
16458c2ecf20Sopenharmony_ci#define FLT_REG_BOOTLOAD_SEC_27XX	0x9
16468c2ecf20Sopenharmony_ci#define FLT_REG_VPD_SEC_27XX_0	0x50
16478c2ecf20Sopenharmony_ci#define FLT_REG_VPD_SEC_27XX_1	0x52
16488c2ecf20Sopenharmony_ci#define FLT_REG_VPD_SEC_27XX_2	0xD8
16498c2ecf20Sopenharmony_ci#define FLT_REG_VPD_SEC_27XX_3	0xDA
16508c2ecf20Sopenharmony_ci
16518c2ecf20Sopenharmony_ci/* 28xx */
16528c2ecf20Sopenharmony_ci#define FLT_REG_AUX_IMG_PRI_28XX	0x125
16538c2ecf20Sopenharmony_ci#define FLT_REG_AUX_IMG_SEC_28XX	0x126
16548c2ecf20Sopenharmony_ci#define FLT_REG_VPD_SEC_28XX_0		0x10C
16558c2ecf20Sopenharmony_ci#define FLT_REG_VPD_SEC_28XX_1		0x10E
16568c2ecf20Sopenharmony_ci#define FLT_REG_VPD_SEC_28XX_2		0x110
16578c2ecf20Sopenharmony_ci#define FLT_REG_VPD_SEC_28XX_3		0x112
16588c2ecf20Sopenharmony_ci#define FLT_REG_NVRAM_SEC_28XX_0	0x10D
16598c2ecf20Sopenharmony_ci#define FLT_REG_NVRAM_SEC_28XX_1	0x10F
16608c2ecf20Sopenharmony_ci#define FLT_REG_NVRAM_SEC_28XX_2	0x111
16618c2ecf20Sopenharmony_ci#define FLT_REG_NVRAM_SEC_28XX_3	0x113
16628c2ecf20Sopenharmony_ci#define FLT_REG_MPI_PRI_28XX		0xD3
16638c2ecf20Sopenharmony_ci#define FLT_REG_MPI_SEC_28XX		0xF0
16648c2ecf20Sopenharmony_ci#define FLT_REG_PEP_PRI_28XX		0xD1
16658c2ecf20Sopenharmony_ci#define FLT_REG_PEP_SEC_28XX		0xF1
16668c2ecf20Sopenharmony_ci
16678c2ecf20Sopenharmony_cistruct qla_flt_region {
16688c2ecf20Sopenharmony_ci	__le16	code;
16698c2ecf20Sopenharmony_ci	uint8_t attribute;
16708c2ecf20Sopenharmony_ci	uint8_t reserved;
16718c2ecf20Sopenharmony_ci	__le32 size;
16728c2ecf20Sopenharmony_ci	__le32 start;
16738c2ecf20Sopenharmony_ci	__le32 end;
16748c2ecf20Sopenharmony_ci};
16758c2ecf20Sopenharmony_ci
16768c2ecf20Sopenharmony_cistruct qla_flt_header {
16778c2ecf20Sopenharmony_ci	__le16	version;
16788c2ecf20Sopenharmony_ci	__le16	length;
16798c2ecf20Sopenharmony_ci	__le16	checksum;
16808c2ecf20Sopenharmony_ci	__le16	unused;
16818c2ecf20Sopenharmony_ci	struct qla_flt_region region[0];
16828c2ecf20Sopenharmony_ci};
16838c2ecf20Sopenharmony_ci
16848c2ecf20Sopenharmony_ci#define FLT_REGION_SIZE		16
16858c2ecf20Sopenharmony_ci#define FLT_MAX_REGIONS		0xFF
16868c2ecf20Sopenharmony_ci#define FLT_REGIONS_SIZE	(FLT_REGION_SIZE * FLT_MAX_REGIONS)
16878c2ecf20Sopenharmony_ci
16888c2ecf20Sopenharmony_ci/* Flash NPIV Configuration Table ********************************************/
16898c2ecf20Sopenharmony_ci
16908c2ecf20Sopenharmony_cistruct qla_npiv_header {
16918c2ecf20Sopenharmony_ci	uint8_t sig[2];
16928c2ecf20Sopenharmony_ci	__le16	version;
16938c2ecf20Sopenharmony_ci	__le16	entries;
16948c2ecf20Sopenharmony_ci	__le16	unused[4];
16958c2ecf20Sopenharmony_ci	__le16	checksum;
16968c2ecf20Sopenharmony_ci};
16978c2ecf20Sopenharmony_ci
16988c2ecf20Sopenharmony_cistruct qla_npiv_entry {
16998c2ecf20Sopenharmony_ci	__le16	flags;
17008c2ecf20Sopenharmony_ci	__le16	vf_id;
17018c2ecf20Sopenharmony_ci	uint8_t q_qos;
17028c2ecf20Sopenharmony_ci	uint8_t f_qos;
17038c2ecf20Sopenharmony_ci	__le16	unused1;
17048c2ecf20Sopenharmony_ci	uint8_t port_name[WWN_SIZE];
17058c2ecf20Sopenharmony_ci	uint8_t node_name[WWN_SIZE];
17068c2ecf20Sopenharmony_ci};
17078c2ecf20Sopenharmony_ci
17088c2ecf20Sopenharmony_ci/* 84XX Support **************************************************************/
17098c2ecf20Sopenharmony_ci
17108c2ecf20Sopenharmony_ci#define MBA_ISP84XX_ALERT	0x800f  /* Alert Notification. */
17118c2ecf20Sopenharmony_ci#define A84_PANIC_RECOVERY	0x1
17128c2ecf20Sopenharmony_ci#define A84_OP_LOGIN_COMPLETE	0x2
17138c2ecf20Sopenharmony_ci#define A84_DIAG_LOGIN_COMPLETE	0x3
17148c2ecf20Sopenharmony_ci#define A84_GOLD_LOGIN_COMPLETE	0x4
17158c2ecf20Sopenharmony_ci
17168c2ecf20Sopenharmony_ci#define MBC_ISP84XX_RESET	0x3a    /* Reset. */
17178c2ecf20Sopenharmony_ci
17188c2ecf20Sopenharmony_ci#define FSTATE_REMOTE_FC_DOWN	BIT_0
17198c2ecf20Sopenharmony_ci#define FSTATE_NSL_LINK_DOWN	BIT_1
17208c2ecf20Sopenharmony_ci#define FSTATE_IS_DIAG_FW	BIT_2
17218c2ecf20Sopenharmony_ci#define FSTATE_LOGGED_IN	BIT_3
17228c2ecf20Sopenharmony_ci#define FSTATE_WAITING_FOR_VERIFY	BIT_4
17238c2ecf20Sopenharmony_ci
17248c2ecf20Sopenharmony_ci#define VERIFY_CHIP_IOCB_TYPE	0x1B
17258c2ecf20Sopenharmony_cistruct verify_chip_entry_84xx {
17268c2ecf20Sopenharmony_ci	uint8_t entry_type;
17278c2ecf20Sopenharmony_ci	uint8_t entry_count;
17288c2ecf20Sopenharmony_ci	uint8_t sys_defined;
17298c2ecf20Sopenharmony_ci	uint8_t entry_status;
17308c2ecf20Sopenharmony_ci
17318c2ecf20Sopenharmony_ci	uint32_t handle;
17328c2ecf20Sopenharmony_ci
17338c2ecf20Sopenharmony_ci	__le16	options;
17348c2ecf20Sopenharmony_ci#define VCO_DONT_UPDATE_FW	BIT_0
17358c2ecf20Sopenharmony_ci#define VCO_FORCE_UPDATE	BIT_1
17368c2ecf20Sopenharmony_ci#define VCO_DONT_RESET_UPDATE	BIT_2
17378c2ecf20Sopenharmony_ci#define VCO_DIAG_FW		BIT_3
17388c2ecf20Sopenharmony_ci#define VCO_END_OF_DATA		BIT_14
17398c2ecf20Sopenharmony_ci#define VCO_ENABLE_DSD		BIT_15
17408c2ecf20Sopenharmony_ci
17418c2ecf20Sopenharmony_ci	__le16	reserved_1;
17428c2ecf20Sopenharmony_ci
17438c2ecf20Sopenharmony_ci	__le16	data_seg_cnt;
17448c2ecf20Sopenharmony_ci	__le16	reserved_2[3];
17458c2ecf20Sopenharmony_ci
17468c2ecf20Sopenharmony_ci	__le32	fw_ver;
17478c2ecf20Sopenharmony_ci	__le32	exchange_address;
17488c2ecf20Sopenharmony_ci
17498c2ecf20Sopenharmony_ci	__le32 reserved_3[3];
17508c2ecf20Sopenharmony_ci	__le32	fw_size;
17518c2ecf20Sopenharmony_ci	__le32	fw_seq_size;
17528c2ecf20Sopenharmony_ci	__le32	relative_offset;
17538c2ecf20Sopenharmony_ci
17548c2ecf20Sopenharmony_ci	struct dsd64 dsd;
17558c2ecf20Sopenharmony_ci};
17568c2ecf20Sopenharmony_ci
17578c2ecf20Sopenharmony_cistruct verify_chip_rsp_84xx {
17588c2ecf20Sopenharmony_ci	uint8_t entry_type;
17598c2ecf20Sopenharmony_ci	uint8_t entry_count;
17608c2ecf20Sopenharmony_ci	uint8_t sys_defined;
17618c2ecf20Sopenharmony_ci	uint8_t entry_status;
17628c2ecf20Sopenharmony_ci
17638c2ecf20Sopenharmony_ci	uint32_t handle;
17648c2ecf20Sopenharmony_ci
17658c2ecf20Sopenharmony_ci	__le16	comp_status;
17668c2ecf20Sopenharmony_ci#define CS_VCS_CHIP_FAILURE	0x3
17678c2ecf20Sopenharmony_ci#define CS_VCS_BAD_EXCHANGE	0x8
17688c2ecf20Sopenharmony_ci#define CS_VCS_SEQ_COMPLETEi	0x40
17698c2ecf20Sopenharmony_ci
17708c2ecf20Sopenharmony_ci	__le16	failure_code;
17718c2ecf20Sopenharmony_ci#define VFC_CHECKSUM_ERROR	0x1
17728c2ecf20Sopenharmony_ci#define VFC_INVALID_LEN		0x2
17738c2ecf20Sopenharmony_ci#define VFC_ALREADY_IN_PROGRESS	0x8
17748c2ecf20Sopenharmony_ci
17758c2ecf20Sopenharmony_ci	__le16	reserved_1[4];
17768c2ecf20Sopenharmony_ci
17778c2ecf20Sopenharmony_ci	__le32	fw_ver;
17788c2ecf20Sopenharmony_ci	__le32	exchange_address;
17798c2ecf20Sopenharmony_ci
17808c2ecf20Sopenharmony_ci	__le32 reserved_2[6];
17818c2ecf20Sopenharmony_ci};
17828c2ecf20Sopenharmony_ci
17838c2ecf20Sopenharmony_ci#define ACCESS_CHIP_IOCB_TYPE	0x2B
17848c2ecf20Sopenharmony_cistruct access_chip_84xx {
17858c2ecf20Sopenharmony_ci	uint8_t entry_type;
17868c2ecf20Sopenharmony_ci	uint8_t entry_count;
17878c2ecf20Sopenharmony_ci	uint8_t sys_defined;
17888c2ecf20Sopenharmony_ci	uint8_t entry_status;
17898c2ecf20Sopenharmony_ci
17908c2ecf20Sopenharmony_ci	uint32_t handle;
17918c2ecf20Sopenharmony_ci
17928c2ecf20Sopenharmony_ci	__le16	options;
17938c2ecf20Sopenharmony_ci#define ACO_DUMP_MEMORY		0x0
17948c2ecf20Sopenharmony_ci#define ACO_LOAD_MEMORY		0x1
17958c2ecf20Sopenharmony_ci#define ACO_CHANGE_CONFIG_PARAM	0x2
17968c2ecf20Sopenharmony_ci#define ACO_REQUEST_INFO	0x3
17978c2ecf20Sopenharmony_ci
17988c2ecf20Sopenharmony_ci	__le16	reserved1;
17998c2ecf20Sopenharmony_ci
18008c2ecf20Sopenharmony_ci	__le16	dseg_count;
18018c2ecf20Sopenharmony_ci	__le16	reserved2[3];
18028c2ecf20Sopenharmony_ci
18038c2ecf20Sopenharmony_ci	__le32	parameter1;
18048c2ecf20Sopenharmony_ci	__le32	parameter2;
18058c2ecf20Sopenharmony_ci	__le32	parameter3;
18068c2ecf20Sopenharmony_ci
18078c2ecf20Sopenharmony_ci	__le32	reserved3[3];
18088c2ecf20Sopenharmony_ci	__le32	total_byte_cnt;
18098c2ecf20Sopenharmony_ci	__le32	reserved4;
18108c2ecf20Sopenharmony_ci
18118c2ecf20Sopenharmony_ci	struct dsd64 dsd;
18128c2ecf20Sopenharmony_ci};
18138c2ecf20Sopenharmony_ci
18148c2ecf20Sopenharmony_cistruct access_chip_rsp_84xx {
18158c2ecf20Sopenharmony_ci	uint8_t entry_type;
18168c2ecf20Sopenharmony_ci	uint8_t entry_count;
18178c2ecf20Sopenharmony_ci	uint8_t sys_defined;
18188c2ecf20Sopenharmony_ci	uint8_t entry_status;
18198c2ecf20Sopenharmony_ci
18208c2ecf20Sopenharmony_ci	uint32_t handle;
18218c2ecf20Sopenharmony_ci
18228c2ecf20Sopenharmony_ci	__le16	comp_status;
18238c2ecf20Sopenharmony_ci	__le16	failure_code;
18248c2ecf20Sopenharmony_ci	__le32	residual_count;
18258c2ecf20Sopenharmony_ci
18268c2ecf20Sopenharmony_ci	__le32	reserved[12];
18278c2ecf20Sopenharmony_ci};
18288c2ecf20Sopenharmony_ci
18298c2ecf20Sopenharmony_ci/* 81XX Support **************************************************************/
18308c2ecf20Sopenharmony_ci
18318c2ecf20Sopenharmony_ci#define MBA_DCBX_START		0x8016
18328c2ecf20Sopenharmony_ci#define MBA_DCBX_COMPLETE	0x8030
18338c2ecf20Sopenharmony_ci#define MBA_FCF_CONF_ERR	0x8031
18348c2ecf20Sopenharmony_ci#define MBA_DCBX_PARAM_UPDATE	0x8032
18358c2ecf20Sopenharmony_ci#define MBA_IDC_COMPLETE	0x8100
18368c2ecf20Sopenharmony_ci#define MBA_IDC_NOTIFY		0x8101
18378c2ecf20Sopenharmony_ci#define MBA_IDC_TIME_EXT	0x8102
18388c2ecf20Sopenharmony_ci
18398c2ecf20Sopenharmony_ci#define MBC_IDC_ACK		0x101
18408c2ecf20Sopenharmony_ci#define MBC_RESTART_MPI_FW	0x3d
18418c2ecf20Sopenharmony_ci#define MBC_FLASH_ACCESS_CTRL	0x3e	/* Control flash access. */
18428c2ecf20Sopenharmony_ci#define MBC_GET_XGMAC_STATS	0x7a
18438c2ecf20Sopenharmony_ci#define MBC_GET_DCBX_PARAMS	0x51
18448c2ecf20Sopenharmony_ci
18458c2ecf20Sopenharmony_ci/*
18468c2ecf20Sopenharmony_ci * ISP83xx mailbox commands
18478c2ecf20Sopenharmony_ci */
18488c2ecf20Sopenharmony_ci#define MBC_WRITE_REMOTE_REG		0x0001 /* Write remote register */
18498c2ecf20Sopenharmony_ci#define MBC_READ_REMOTE_REG		0x0009 /* Read remote register */
18508c2ecf20Sopenharmony_ci#define MBC_RESTART_NIC_FIRMWARE	0x003d /* Restart NIC firmware */
18518c2ecf20Sopenharmony_ci#define MBC_SET_ACCESS_CONTROL		0x003e /* Access control command */
18528c2ecf20Sopenharmony_ci
18538c2ecf20Sopenharmony_ci/* Flash access control option field bit definitions */
18548c2ecf20Sopenharmony_ci#define FAC_OPT_FORCE_SEMAPHORE		BIT_15
18558c2ecf20Sopenharmony_ci#define FAC_OPT_REQUESTOR_ID		BIT_14
18568c2ecf20Sopenharmony_ci#define FAC_OPT_CMD_SUBCODE		0xff
18578c2ecf20Sopenharmony_ci
18588c2ecf20Sopenharmony_ci/* Flash access control command subcodes */
18598c2ecf20Sopenharmony_ci#define FAC_OPT_CMD_WRITE_PROTECT	0x00
18608c2ecf20Sopenharmony_ci#define FAC_OPT_CMD_WRITE_ENABLE	0x01
18618c2ecf20Sopenharmony_ci#define FAC_OPT_CMD_ERASE_SECTOR	0x02
18628c2ecf20Sopenharmony_ci#define FAC_OPT_CMD_LOCK_SEMAPHORE	0x03
18638c2ecf20Sopenharmony_ci#define FAC_OPT_CMD_UNLOCK_SEMAPHORE	0x04
18648c2ecf20Sopenharmony_ci#define FAC_OPT_CMD_GET_SECTOR_SIZE	0x05
18658c2ecf20Sopenharmony_ci
18668c2ecf20Sopenharmony_ci/* enhanced features bit definitions */
18678c2ecf20Sopenharmony_ci#define NEF_LR_DIST_ENABLE	BIT_0
18688c2ecf20Sopenharmony_ci
18698c2ecf20Sopenharmony_ci/* LR Distance bit positions */
18708c2ecf20Sopenharmony_ci#define LR_DIST_NV_POS		2
18718c2ecf20Sopenharmony_ci#define LR_DIST_NV_MASK		0xf
18728c2ecf20Sopenharmony_ci#define LR_DIST_FW_POS		12
18738c2ecf20Sopenharmony_ci
18748c2ecf20Sopenharmony_ci/* FAC semaphore defines */
18758c2ecf20Sopenharmony_ci#define FAC_SEMAPHORE_UNLOCK    0
18768c2ecf20Sopenharmony_ci#define FAC_SEMAPHORE_LOCK      1
18778c2ecf20Sopenharmony_ci
18788c2ecf20Sopenharmony_cistruct nvram_81xx {
18798c2ecf20Sopenharmony_ci	/* NVRAM header. */
18808c2ecf20Sopenharmony_ci	uint8_t id[4];
18818c2ecf20Sopenharmony_ci	__le16	nvram_version;
18828c2ecf20Sopenharmony_ci	__le16	reserved_0;
18838c2ecf20Sopenharmony_ci
18848c2ecf20Sopenharmony_ci	/* Firmware Initialization Control Block. */
18858c2ecf20Sopenharmony_ci	__le16	version;
18868c2ecf20Sopenharmony_ci	__le16	reserved_1;
18878c2ecf20Sopenharmony_ci	__le16	frame_payload_size;
18888c2ecf20Sopenharmony_ci	__le16	execution_throttle;
18898c2ecf20Sopenharmony_ci	__le16	exchange_count;
18908c2ecf20Sopenharmony_ci	__le16	reserved_2;
18918c2ecf20Sopenharmony_ci
18928c2ecf20Sopenharmony_ci	uint8_t port_name[WWN_SIZE];
18938c2ecf20Sopenharmony_ci	uint8_t node_name[WWN_SIZE];
18948c2ecf20Sopenharmony_ci
18958c2ecf20Sopenharmony_ci	__le16	login_retry_count;
18968c2ecf20Sopenharmony_ci	__le16	reserved_3;
18978c2ecf20Sopenharmony_ci	__le16	interrupt_delay_timer;
18988c2ecf20Sopenharmony_ci	__le16	login_timeout;
18998c2ecf20Sopenharmony_ci
19008c2ecf20Sopenharmony_ci	__le32	firmware_options_1;
19018c2ecf20Sopenharmony_ci	__le32	firmware_options_2;
19028c2ecf20Sopenharmony_ci	__le32	firmware_options_3;
19038c2ecf20Sopenharmony_ci
19048c2ecf20Sopenharmony_ci	__le16	reserved_4[4];
19058c2ecf20Sopenharmony_ci
19068c2ecf20Sopenharmony_ci	/* Offset 64. */
19078c2ecf20Sopenharmony_ci	uint8_t enode_mac[6];
19088c2ecf20Sopenharmony_ci	__le16	reserved_5[5];
19098c2ecf20Sopenharmony_ci
19108c2ecf20Sopenharmony_ci	/* Offset 80. */
19118c2ecf20Sopenharmony_ci	__le16	reserved_6[24];
19128c2ecf20Sopenharmony_ci
19138c2ecf20Sopenharmony_ci	/* Offset 128. */
19148c2ecf20Sopenharmony_ci	__le16	ex_version;
19158c2ecf20Sopenharmony_ci	uint8_t prio_fcf_matching_flags;
19168c2ecf20Sopenharmony_ci	uint8_t reserved_6_1[3];
19178c2ecf20Sopenharmony_ci	__le16	pri_fcf_vlan_id;
19188c2ecf20Sopenharmony_ci	uint8_t pri_fcf_fabric_name[8];
19198c2ecf20Sopenharmony_ci	__le16	reserved_6_2[7];
19208c2ecf20Sopenharmony_ci	uint8_t spma_mac_addr[6];
19218c2ecf20Sopenharmony_ci	__le16	reserved_6_3[14];
19228c2ecf20Sopenharmony_ci
19238c2ecf20Sopenharmony_ci	/* Offset 192. */
19248c2ecf20Sopenharmony_ci	uint8_t min_supported_speed;
19258c2ecf20Sopenharmony_ci	uint8_t reserved_7_0;
19268c2ecf20Sopenharmony_ci	__le16	reserved_7[31];
19278c2ecf20Sopenharmony_ci
19288c2ecf20Sopenharmony_ci	/*
19298c2ecf20Sopenharmony_ci	 * BIT 0  = Enable spinup delay
19308c2ecf20Sopenharmony_ci	 * BIT 1  = Disable BIOS
19318c2ecf20Sopenharmony_ci	 * BIT 2  = Enable Memory Map BIOS
19328c2ecf20Sopenharmony_ci	 * BIT 3  = Enable Selectable Boot
19338c2ecf20Sopenharmony_ci	 * BIT 4  = Disable RISC code load
19348c2ecf20Sopenharmony_ci	 * BIT 5  = Disable Serdes
19358c2ecf20Sopenharmony_ci	 * BIT 6  = Opt boot mode
19368c2ecf20Sopenharmony_ci	 * BIT 7  = Interrupt enable
19378c2ecf20Sopenharmony_ci	 *
19388c2ecf20Sopenharmony_ci	 * BIT 8  = EV Control enable
19398c2ecf20Sopenharmony_ci	 * BIT 9  = Enable lip reset
19408c2ecf20Sopenharmony_ci	 * BIT 10 = Enable lip full login
19418c2ecf20Sopenharmony_ci	 * BIT 11 = Enable target reset
19428c2ecf20Sopenharmony_ci	 * BIT 12 = Stop firmware
19438c2ecf20Sopenharmony_ci	 * BIT 13 = Enable nodename option
19448c2ecf20Sopenharmony_ci	 * BIT 14 = Default WWPN valid
19458c2ecf20Sopenharmony_ci	 * BIT 15 = Enable alternate WWN
19468c2ecf20Sopenharmony_ci	 *
19478c2ecf20Sopenharmony_ci	 * BIT 16 = CLP LUN string
19488c2ecf20Sopenharmony_ci	 * BIT 17 = CLP Target string
19498c2ecf20Sopenharmony_ci	 * BIT 18 = CLP BIOS enable string
19508c2ecf20Sopenharmony_ci	 * BIT 19 = CLP Serdes string
19518c2ecf20Sopenharmony_ci	 * BIT 20 = CLP WWPN string
19528c2ecf20Sopenharmony_ci	 * BIT 21 = CLP WWNN string
19538c2ecf20Sopenharmony_ci	 * BIT 22 =
19548c2ecf20Sopenharmony_ci	 * BIT 23 =
19558c2ecf20Sopenharmony_ci	 * BIT 24 = Keep WWPN
19568c2ecf20Sopenharmony_ci	 * BIT 25 = Temp WWPN
19578c2ecf20Sopenharmony_ci	 * BIT 26-31 =
19588c2ecf20Sopenharmony_ci	 */
19598c2ecf20Sopenharmony_ci	__le32	host_p;
19608c2ecf20Sopenharmony_ci
19618c2ecf20Sopenharmony_ci	uint8_t alternate_port_name[WWN_SIZE];
19628c2ecf20Sopenharmony_ci	uint8_t alternate_node_name[WWN_SIZE];
19638c2ecf20Sopenharmony_ci
19648c2ecf20Sopenharmony_ci	uint8_t boot_port_name[WWN_SIZE];
19658c2ecf20Sopenharmony_ci	__le16	boot_lun_number;
19668c2ecf20Sopenharmony_ci	__le16	reserved_8;
19678c2ecf20Sopenharmony_ci
19688c2ecf20Sopenharmony_ci	uint8_t alt1_boot_port_name[WWN_SIZE];
19698c2ecf20Sopenharmony_ci	__le16	alt1_boot_lun_number;
19708c2ecf20Sopenharmony_ci	__le16	reserved_9;
19718c2ecf20Sopenharmony_ci
19728c2ecf20Sopenharmony_ci	uint8_t alt2_boot_port_name[WWN_SIZE];
19738c2ecf20Sopenharmony_ci	__le16	alt2_boot_lun_number;
19748c2ecf20Sopenharmony_ci	__le16	reserved_10;
19758c2ecf20Sopenharmony_ci
19768c2ecf20Sopenharmony_ci	uint8_t alt3_boot_port_name[WWN_SIZE];
19778c2ecf20Sopenharmony_ci	__le16	alt3_boot_lun_number;
19788c2ecf20Sopenharmony_ci	__le16	reserved_11;
19798c2ecf20Sopenharmony_ci
19808c2ecf20Sopenharmony_ci	/*
19818c2ecf20Sopenharmony_ci	 * BIT 0 = Selective Login
19828c2ecf20Sopenharmony_ci	 * BIT 1 = Alt-Boot Enable
19838c2ecf20Sopenharmony_ci	 * BIT 2 = Reserved
19848c2ecf20Sopenharmony_ci	 * BIT 3 = Boot Order List
19858c2ecf20Sopenharmony_ci	 * BIT 4 = Reserved
19868c2ecf20Sopenharmony_ci	 * BIT 5 = Selective LUN
19878c2ecf20Sopenharmony_ci	 * BIT 6 = Reserved
19888c2ecf20Sopenharmony_ci	 * BIT 7-31 =
19898c2ecf20Sopenharmony_ci	 */
19908c2ecf20Sopenharmony_ci	__le32	efi_parameters;
19918c2ecf20Sopenharmony_ci
19928c2ecf20Sopenharmony_ci	uint8_t reset_delay;
19938c2ecf20Sopenharmony_ci	uint8_t reserved_12;
19948c2ecf20Sopenharmony_ci	__le16	reserved_13;
19958c2ecf20Sopenharmony_ci
19968c2ecf20Sopenharmony_ci	__le16	boot_id_number;
19978c2ecf20Sopenharmony_ci	__le16	reserved_14;
19988c2ecf20Sopenharmony_ci
19998c2ecf20Sopenharmony_ci	__le16	max_luns_per_target;
20008c2ecf20Sopenharmony_ci	__le16	reserved_15;
20018c2ecf20Sopenharmony_ci
20028c2ecf20Sopenharmony_ci	__le16	port_down_retry_count;
20038c2ecf20Sopenharmony_ci	__le16	link_down_timeout;
20048c2ecf20Sopenharmony_ci
20058c2ecf20Sopenharmony_ci	/* FCode parameters. */
20068c2ecf20Sopenharmony_ci	__le16	fcode_parameter;
20078c2ecf20Sopenharmony_ci
20088c2ecf20Sopenharmony_ci	__le16	reserved_16[3];
20098c2ecf20Sopenharmony_ci
20108c2ecf20Sopenharmony_ci	/* Offset 352. */
20118c2ecf20Sopenharmony_ci	uint8_t reserved_17[4];
20128c2ecf20Sopenharmony_ci	__le16	reserved_18[5];
20138c2ecf20Sopenharmony_ci	uint8_t reserved_19[2];
20148c2ecf20Sopenharmony_ci	__le16	reserved_20[8];
20158c2ecf20Sopenharmony_ci
20168c2ecf20Sopenharmony_ci	/* Offset 384. */
20178c2ecf20Sopenharmony_ci	uint8_t reserved_21[16];
20188c2ecf20Sopenharmony_ci	__le16	reserved_22[3];
20198c2ecf20Sopenharmony_ci
20208c2ecf20Sopenharmony_ci	/* Offset 406 (0x196) Enhanced Features
20218c2ecf20Sopenharmony_ci	 * BIT 0    = Extended BB credits for LR
20228c2ecf20Sopenharmony_ci	 * BIT 1    = Virtual Fabric Enable
20238c2ecf20Sopenharmony_ci	 * BIT 2-5  = Distance Support if BIT 0 is on
20248c2ecf20Sopenharmony_ci	 * BIT 6    = Prefer FCP
20258c2ecf20Sopenharmony_ci	 * BIT 7    = SCM Disabled if BIT is set (1)
20268c2ecf20Sopenharmony_ci	 * BIT 8-15 = Unused
20278c2ecf20Sopenharmony_ci	 */
20288c2ecf20Sopenharmony_ci	uint16_t enhanced_features;
20298c2ecf20Sopenharmony_ci
20308c2ecf20Sopenharmony_ci	uint16_t reserved_24[4];
20318c2ecf20Sopenharmony_ci
20328c2ecf20Sopenharmony_ci	/* Offset 416. */
20338c2ecf20Sopenharmony_ci	__le16	reserved_25[32];
20348c2ecf20Sopenharmony_ci
20358c2ecf20Sopenharmony_ci	/* Offset 480. */
20368c2ecf20Sopenharmony_ci	uint8_t model_name[16];
20378c2ecf20Sopenharmony_ci
20388c2ecf20Sopenharmony_ci	/* Offset 496. */
20398c2ecf20Sopenharmony_ci	__le16	feature_mask_l;
20408c2ecf20Sopenharmony_ci	__le16	feature_mask_h;
20418c2ecf20Sopenharmony_ci	__le16	reserved_26[2];
20428c2ecf20Sopenharmony_ci
20438c2ecf20Sopenharmony_ci	__le16	subsystem_vendor_id;
20448c2ecf20Sopenharmony_ci	__le16	subsystem_device_id;
20458c2ecf20Sopenharmony_ci
20468c2ecf20Sopenharmony_ci	__le32	checksum;
20478c2ecf20Sopenharmony_ci};
20488c2ecf20Sopenharmony_ci
20498c2ecf20Sopenharmony_ci/*
20508c2ecf20Sopenharmony_ci * ISP Initialization Control Block.
20518c2ecf20Sopenharmony_ci * Little endian except where noted.
20528c2ecf20Sopenharmony_ci */
20538c2ecf20Sopenharmony_ci#define	ICB_VERSION 1
20548c2ecf20Sopenharmony_cistruct init_cb_81xx {
20558c2ecf20Sopenharmony_ci	__le16	version;
20568c2ecf20Sopenharmony_ci	__le16	reserved_1;
20578c2ecf20Sopenharmony_ci
20588c2ecf20Sopenharmony_ci	__le16	frame_payload_size;
20598c2ecf20Sopenharmony_ci	__le16	execution_throttle;
20608c2ecf20Sopenharmony_ci	__le16	exchange_count;
20618c2ecf20Sopenharmony_ci
20628c2ecf20Sopenharmony_ci	__le16	reserved_2;
20638c2ecf20Sopenharmony_ci
20648c2ecf20Sopenharmony_ci	uint8_t port_name[WWN_SIZE];		/* Big endian. */
20658c2ecf20Sopenharmony_ci	uint8_t node_name[WWN_SIZE];		/* Big endian. */
20668c2ecf20Sopenharmony_ci
20678c2ecf20Sopenharmony_ci	__le16	response_q_inpointer;
20688c2ecf20Sopenharmony_ci	__le16	request_q_outpointer;
20698c2ecf20Sopenharmony_ci
20708c2ecf20Sopenharmony_ci	__le16	login_retry_count;
20718c2ecf20Sopenharmony_ci
20728c2ecf20Sopenharmony_ci	__le16	prio_request_q_outpointer;
20738c2ecf20Sopenharmony_ci
20748c2ecf20Sopenharmony_ci	__le16	response_q_length;
20758c2ecf20Sopenharmony_ci	__le16	request_q_length;
20768c2ecf20Sopenharmony_ci
20778c2ecf20Sopenharmony_ci	__le16	reserved_3;
20788c2ecf20Sopenharmony_ci
20798c2ecf20Sopenharmony_ci	__le16	prio_request_q_length;
20808c2ecf20Sopenharmony_ci
20818c2ecf20Sopenharmony_ci	__le64	 request_q_address __packed;
20828c2ecf20Sopenharmony_ci	__le64	 response_q_address __packed;
20838c2ecf20Sopenharmony_ci	__le64	 prio_request_q_address __packed;
20848c2ecf20Sopenharmony_ci
20858c2ecf20Sopenharmony_ci	uint8_t reserved_4[8];
20868c2ecf20Sopenharmony_ci
20878c2ecf20Sopenharmony_ci	__le16	atio_q_inpointer;
20888c2ecf20Sopenharmony_ci	__le16	atio_q_length;
20898c2ecf20Sopenharmony_ci	__le64	 atio_q_address __packed;
20908c2ecf20Sopenharmony_ci
20918c2ecf20Sopenharmony_ci	__le16	interrupt_delay_timer;		/* 100us increments. */
20928c2ecf20Sopenharmony_ci	__le16	login_timeout;
20938c2ecf20Sopenharmony_ci
20948c2ecf20Sopenharmony_ci	/*
20958c2ecf20Sopenharmony_ci	 * BIT 0-3 = Reserved
20968c2ecf20Sopenharmony_ci	 * BIT 4  = Enable Target Mode
20978c2ecf20Sopenharmony_ci	 * BIT 5  = Disable Initiator Mode
20988c2ecf20Sopenharmony_ci	 * BIT 6  = Reserved
20998c2ecf20Sopenharmony_ci	 * BIT 7  = Reserved
21008c2ecf20Sopenharmony_ci	 *
21018c2ecf20Sopenharmony_ci	 * BIT 8-13 = Reserved
21028c2ecf20Sopenharmony_ci	 * BIT 14 = Node Name Option
21038c2ecf20Sopenharmony_ci	 * BIT 15-31 = Reserved
21048c2ecf20Sopenharmony_ci	 */
21058c2ecf20Sopenharmony_ci	__le32	firmware_options_1;
21068c2ecf20Sopenharmony_ci
21078c2ecf20Sopenharmony_ci	/*
21088c2ecf20Sopenharmony_ci	 * BIT 0  = Operation Mode bit 0
21098c2ecf20Sopenharmony_ci	 * BIT 1  = Operation Mode bit 1
21108c2ecf20Sopenharmony_ci	 * BIT 2  = Operation Mode bit 2
21118c2ecf20Sopenharmony_ci	 * BIT 3  = Operation Mode bit 3
21128c2ecf20Sopenharmony_ci	 * BIT 4-7 = Reserved
21138c2ecf20Sopenharmony_ci	 *
21148c2ecf20Sopenharmony_ci	 * BIT 8  = Enable Class 2
21158c2ecf20Sopenharmony_ci	 * BIT 9  = Enable ACK0
21168c2ecf20Sopenharmony_ci	 * BIT 10 = Reserved
21178c2ecf20Sopenharmony_ci	 * BIT 11 = Enable FC-SP Security
21188c2ecf20Sopenharmony_ci	 * BIT 12 = FC Tape Enable
21198c2ecf20Sopenharmony_ci	 * BIT 13 = Reserved
21208c2ecf20Sopenharmony_ci	 * BIT 14 = Enable Target PRLI Control
21218c2ecf20Sopenharmony_ci	 * BIT 15-31 = Reserved
21228c2ecf20Sopenharmony_ci	 */
21238c2ecf20Sopenharmony_ci	__le32	firmware_options_2;
21248c2ecf20Sopenharmony_ci
21258c2ecf20Sopenharmony_ci	/*
21268c2ecf20Sopenharmony_ci	 * BIT 0-3 = Reserved
21278c2ecf20Sopenharmony_ci	 * BIT 4  = FCP RSP Payload bit 0
21288c2ecf20Sopenharmony_ci	 * BIT 5  = FCP RSP Payload bit 1
21298c2ecf20Sopenharmony_ci	 * BIT 6  = Enable Receive Out-of-Order data frame handling
21308c2ecf20Sopenharmony_ci	 * BIT 7  = Reserved
21318c2ecf20Sopenharmony_ci	 *
21328c2ecf20Sopenharmony_ci	 * BIT 8  = Reserved
21338c2ecf20Sopenharmony_ci	 * BIT 9  = Enable Out-of-Order FCP_XFER_RDY relative offset handling
21348c2ecf20Sopenharmony_ci	 * BIT 10-16 = Reserved
21358c2ecf20Sopenharmony_ci	 * BIT 17 = Enable multiple FCFs
21368c2ecf20Sopenharmony_ci	 * BIT 18-20 = MAC addressing mode
21378c2ecf20Sopenharmony_ci	 * BIT 21-25 = Ethernet data rate
21388c2ecf20Sopenharmony_ci	 * BIT 26 = Enable ethernet header rx IOCB for ATIO q
21398c2ecf20Sopenharmony_ci	 * BIT 27 = Enable ethernet header rx IOCB for response q
21408c2ecf20Sopenharmony_ci	 * BIT 28 = SPMA selection bit 0
21418c2ecf20Sopenharmony_ci	 * BIT 28 = SPMA selection bit 1
21428c2ecf20Sopenharmony_ci	 * BIT 30-31 = Reserved
21438c2ecf20Sopenharmony_ci	 */
21448c2ecf20Sopenharmony_ci	__le32	firmware_options_3;
21458c2ecf20Sopenharmony_ci
21468c2ecf20Sopenharmony_ci	uint8_t  reserved_5[8];
21478c2ecf20Sopenharmony_ci
21488c2ecf20Sopenharmony_ci	uint8_t enode_mac[6];
21498c2ecf20Sopenharmony_ci
21508c2ecf20Sopenharmony_ci	uint8_t reserved_6[10];
21518c2ecf20Sopenharmony_ci};
21528c2ecf20Sopenharmony_ci
21538c2ecf20Sopenharmony_cistruct mid_init_cb_81xx {
21548c2ecf20Sopenharmony_ci	struct init_cb_81xx init_cb;
21558c2ecf20Sopenharmony_ci
21568c2ecf20Sopenharmony_ci	uint16_t count;
21578c2ecf20Sopenharmony_ci	uint16_t options;
21588c2ecf20Sopenharmony_ci
21598c2ecf20Sopenharmony_ci	struct mid_conf_entry_24xx entries[MAX_MULTI_ID_FABRIC];
21608c2ecf20Sopenharmony_ci};
21618c2ecf20Sopenharmony_ci
21628c2ecf20Sopenharmony_cistruct ex_init_cb_81xx {
21638c2ecf20Sopenharmony_ci	uint16_t ex_version;
21648c2ecf20Sopenharmony_ci	uint8_t prio_fcf_matching_flags;
21658c2ecf20Sopenharmony_ci	uint8_t reserved_1[3];
21668c2ecf20Sopenharmony_ci	uint16_t pri_fcf_vlan_id;
21678c2ecf20Sopenharmony_ci	uint8_t pri_fcf_fabric_name[8];
21688c2ecf20Sopenharmony_ci	uint16_t reserved_2[7];
21698c2ecf20Sopenharmony_ci	uint8_t spma_mac_addr[6];
21708c2ecf20Sopenharmony_ci	uint16_t reserved_3[14];
21718c2ecf20Sopenharmony_ci};
21728c2ecf20Sopenharmony_ci
21738c2ecf20Sopenharmony_ci#define FARX_ACCESS_FLASH_CONF_81XX	0x7FFD0000
21748c2ecf20Sopenharmony_ci#define FARX_ACCESS_FLASH_DATA_81XX	0x7F800000
21758c2ecf20Sopenharmony_ci#define FARX_ACCESS_FLASH_CONF_28XX	0x7FFD0000
21768c2ecf20Sopenharmony_ci#define FARX_ACCESS_FLASH_DATA_28XX	0x7F7D0000
21778c2ecf20Sopenharmony_ci
21788c2ecf20Sopenharmony_ci/* FCP priority config defines *************************************/
21798c2ecf20Sopenharmony_ci/* operations */
21808c2ecf20Sopenharmony_ci#define QLFC_FCP_PRIO_DISABLE           0x0
21818c2ecf20Sopenharmony_ci#define QLFC_FCP_PRIO_ENABLE            0x1
21828c2ecf20Sopenharmony_ci#define QLFC_FCP_PRIO_GET_CONFIG        0x2
21838c2ecf20Sopenharmony_ci#define QLFC_FCP_PRIO_SET_CONFIG        0x3
21848c2ecf20Sopenharmony_ci
21858c2ecf20Sopenharmony_cistruct qla_fcp_prio_entry {
21868c2ecf20Sopenharmony_ci	uint16_t flags;         /* Describes parameter(s) in FCP        */
21878c2ecf20Sopenharmony_ci	/* priority entry that are valid        */
21888c2ecf20Sopenharmony_ci#define FCP_PRIO_ENTRY_VALID            0x1
21898c2ecf20Sopenharmony_ci#define FCP_PRIO_ENTRY_TAG_VALID        0x2
21908c2ecf20Sopenharmony_ci#define FCP_PRIO_ENTRY_SPID_VALID       0x4
21918c2ecf20Sopenharmony_ci#define FCP_PRIO_ENTRY_DPID_VALID       0x8
21928c2ecf20Sopenharmony_ci#define FCP_PRIO_ENTRY_LUNB_VALID       0x10
21938c2ecf20Sopenharmony_ci#define FCP_PRIO_ENTRY_LUNE_VALID       0x20
21948c2ecf20Sopenharmony_ci#define FCP_PRIO_ENTRY_SWWN_VALID       0x40
21958c2ecf20Sopenharmony_ci#define FCP_PRIO_ENTRY_DWWN_VALID       0x80
21968c2ecf20Sopenharmony_ci	uint8_t  tag;           /* Priority value                   */
21978c2ecf20Sopenharmony_ci	uint8_t  reserved;      /* Reserved for future use          */
21988c2ecf20Sopenharmony_ci	uint32_t src_pid;       /* Src port id. high order byte     */
21998c2ecf20Sopenharmony_ci				/* unused; -1 (wild card)           */
22008c2ecf20Sopenharmony_ci	uint32_t dst_pid;       /* Src port id. high order byte     */
22018c2ecf20Sopenharmony_ci	/* unused; -1 (wild card)           */
22028c2ecf20Sopenharmony_ci	uint16_t lun_beg;       /* 1st lun num of lun range.        */
22038c2ecf20Sopenharmony_ci				/* -1 (wild card)                   */
22048c2ecf20Sopenharmony_ci	uint16_t lun_end;       /* 2nd lun num of lun range.        */
22058c2ecf20Sopenharmony_ci				/* -1 (wild card)                   */
22068c2ecf20Sopenharmony_ci	uint8_t  src_wwpn[8];   /* Source WWPN: -1 (wild card)      */
22078c2ecf20Sopenharmony_ci	uint8_t  dst_wwpn[8];   /* Destination WWPN: -1 (wild card) */
22088c2ecf20Sopenharmony_ci};
22098c2ecf20Sopenharmony_ci
22108c2ecf20Sopenharmony_cistruct qla_fcp_prio_cfg {
22118c2ecf20Sopenharmony_ci	uint8_t  signature[4];  /* "HQOS" signature of config data  */
22128c2ecf20Sopenharmony_ci	uint16_t version;       /* 1: Initial version               */
22138c2ecf20Sopenharmony_ci	uint16_t length;        /* config data size in num bytes    */
22148c2ecf20Sopenharmony_ci	uint16_t checksum;      /* config data bytes checksum       */
22158c2ecf20Sopenharmony_ci	uint16_t num_entries;   /* Number of entries                */
22168c2ecf20Sopenharmony_ci	uint16_t size_of_entry; /* Size of each entry in num bytes  */
22178c2ecf20Sopenharmony_ci	uint8_t  attributes;    /* enable/disable, persistence      */
22188c2ecf20Sopenharmony_ci#define FCP_PRIO_ATTR_DISABLE   0x0
22198c2ecf20Sopenharmony_ci#define FCP_PRIO_ATTR_ENABLE    0x1
22208c2ecf20Sopenharmony_ci#define FCP_PRIO_ATTR_PERSIST   0x2
22218c2ecf20Sopenharmony_ci	uint8_t  reserved;      /* Reserved for future use          */
22228c2ecf20Sopenharmony_ci#define FCP_PRIO_CFG_HDR_SIZE   offsetof(struct qla_fcp_prio_cfg, entry)
22238c2ecf20Sopenharmony_ci	struct qla_fcp_prio_entry entry[1023]; /* fcp priority entries  */
22248c2ecf20Sopenharmony_ci	uint8_t  reserved2[16];
22258c2ecf20Sopenharmony_ci};
22268c2ecf20Sopenharmony_ci
22278c2ecf20Sopenharmony_ci#define FCP_PRIO_CFG_SIZE       (32*1024) /* fcp prio data per port*/
22288c2ecf20Sopenharmony_ci
22298c2ecf20Sopenharmony_ci/* 25XX Support ****************************************************/
22308c2ecf20Sopenharmony_ci#define FA_FCP_PRIO0_ADDR_25	0x3C000
22318c2ecf20Sopenharmony_ci#define FA_FCP_PRIO1_ADDR_25	0x3E000
22328c2ecf20Sopenharmony_ci
22338c2ecf20Sopenharmony_ci/* 81XX Flash locations -- occupies second 2MB region. */
22348c2ecf20Sopenharmony_ci#define FA_BOOT_CODE_ADDR_81	0x80000
22358c2ecf20Sopenharmony_ci#define FA_RISC_CODE_ADDR_81	0xA0000
22368c2ecf20Sopenharmony_ci#define FA_FW_AREA_ADDR_81	0xC0000
22378c2ecf20Sopenharmony_ci#define FA_VPD_NVRAM_ADDR_81	0xD0000
22388c2ecf20Sopenharmony_ci#define FA_VPD0_ADDR_81		0xD0000
22398c2ecf20Sopenharmony_ci#define FA_VPD1_ADDR_81		0xD0400
22408c2ecf20Sopenharmony_ci#define FA_NVRAM0_ADDR_81	0xD0080
22418c2ecf20Sopenharmony_ci#define FA_NVRAM1_ADDR_81	0xD0180
22428c2ecf20Sopenharmony_ci#define FA_FEATURE_ADDR_81	0xD4000
22438c2ecf20Sopenharmony_ci#define FA_FLASH_DESCR_ADDR_81	0xD8000
22448c2ecf20Sopenharmony_ci#define FA_FLASH_LAYOUT_ADDR_81	0xD8400
22458c2ecf20Sopenharmony_ci#define FA_HW_EVENT0_ADDR_81	0xDC000
22468c2ecf20Sopenharmony_ci#define FA_HW_EVENT1_ADDR_81	0xDC400
22478c2ecf20Sopenharmony_ci#define FA_NPIV_CONF0_ADDR_81	0xD1000
22488c2ecf20Sopenharmony_ci#define FA_NPIV_CONF1_ADDR_81	0xD2000
22498c2ecf20Sopenharmony_ci
22508c2ecf20Sopenharmony_ci/* 83XX Flash locations -- occupies second 8MB region. */
22518c2ecf20Sopenharmony_ci#define FA_FLASH_LAYOUT_ADDR_83	(0x3F1000/4)
22528c2ecf20Sopenharmony_ci#define FA_FLASH_LAYOUT_ADDR_28	(0x11000/4)
22538c2ecf20Sopenharmony_ci
22548c2ecf20Sopenharmony_ci#define NVRAM_DUAL_FCP_NVME_FLAG_OFFSET	0x196
22558c2ecf20Sopenharmony_ci
22568c2ecf20Sopenharmony_ci#endif
2257