162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * QLogic Fibre Channel HBA Driver 462306a36Sopenharmony_ci * Copyright (c) 2003-2014 QLogic Corporation 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci#ifndef __QLA_MR_H 762306a36Sopenharmony_ci#define __QLA_MR_H 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include "qla_dsd.h" 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci/* 1262306a36Sopenharmony_ci * The PCI VendorID and DeviceID for our board. 1362306a36Sopenharmony_ci */ 1462306a36Sopenharmony_ci#define PCI_DEVICE_ID_QLOGIC_ISPF001 0xF001 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* FX00 specific definitions */ 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define FX00_COMMAND_TYPE_7 0x07 /* Command Type 7 entry for 7XXX */ 1962306a36Sopenharmony_cistruct cmd_type_7_fx00 { 2062306a36Sopenharmony_ci uint8_t entry_type; /* Entry type. */ 2162306a36Sopenharmony_ci uint8_t entry_count; /* Entry count. */ 2262306a36Sopenharmony_ci uint8_t sys_define; /* System defined. */ 2362306a36Sopenharmony_ci uint8_t entry_status; /* Entry Status. */ 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci uint32_t handle; /* System handle. */ 2662306a36Sopenharmony_ci uint8_t reserved_0; 2762306a36Sopenharmony_ci uint8_t port_path_ctrl; 2862306a36Sopenharmony_ci uint16_t reserved_1; 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci __le16 tgt_idx; /* Target Idx. */ 3162306a36Sopenharmony_ci uint16_t timeout; /* Command timeout. */ 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci __le16 dseg_count; /* Data segment count. */ 3462306a36Sopenharmony_ci uint8_t scsi_rsp_dsd_len; 3562306a36Sopenharmony_ci uint8_t reserved_2; 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci struct scsi_lun lun; /* LUN (LE). */ 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci uint8_t cntrl_flags; 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci uint8_t task_mgmt_flags; /* Task management flags. */ 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci uint8_t task; 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci uint8_t crn; 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci uint8_t fcp_cdb[MAX_CMDSZ]; /* SCSI command words. */ 4862306a36Sopenharmony_ci __le32 byte_count; /* Total byte count. */ 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci struct dsd64 dsd; 5162306a36Sopenharmony_ci}; 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci#define STATUS_TYPE_FX00 0x01 /* Status entry. */ 5462306a36Sopenharmony_cistruct sts_entry_fx00 { 5562306a36Sopenharmony_ci uint8_t entry_type; /* Entry type. */ 5662306a36Sopenharmony_ci uint8_t entry_count; /* Entry count. */ 5762306a36Sopenharmony_ci uint8_t sys_define; /* System defined. */ 5862306a36Sopenharmony_ci uint8_t entry_status; /* Entry Status. */ 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci uint32_t handle; /* System handle. */ 6162306a36Sopenharmony_ci uint32_t reserved_3; /* System handle. */ 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci __le16 comp_status; /* Completion status. */ 6462306a36Sopenharmony_ci uint16_t reserved_0; /* OX_ID used by the firmware. */ 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci __le32 residual_len; /* FW calc residual transfer length. */ 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci uint16_t reserved_1; 6962306a36Sopenharmony_ci uint16_t state_flags; /* State flags. */ 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci uint16_t reserved_2; 7262306a36Sopenharmony_ci __le16 scsi_status; /* SCSI status. */ 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci uint32_t sense_len; /* FCP SENSE length. */ 7562306a36Sopenharmony_ci uint8_t data[32]; /* FCP response/sense information. */ 7662306a36Sopenharmony_ci}; 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci#define MAX_HANDLE_COUNT 15 8062306a36Sopenharmony_ci#define MULTI_STATUS_TYPE_FX00 0x0D 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_cistruct multi_sts_entry_fx00 { 8362306a36Sopenharmony_ci uint8_t entry_type; /* Entry type. */ 8462306a36Sopenharmony_ci uint8_t entry_count; /* Entry count. */ 8562306a36Sopenharmony_ci uint8_t handle_count; 8662306a36Sopenharmony_ci uint8_t entry_status; 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci __le32 handles[MAX_HANDLE_COUNT]; 8962306a36Sopenharmony_ci}; 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci#define TSK_MGMT_IOCB_TYPE_FX00 0x05 9262306a36Sopenharmony_cistruct tsk_mgmt_entry_fx00 { 9362306a36Sopenharmony_ci uint8_t entry_type; /* Entry type. */ 9462306a36Sopenharmony_ci uint8_t entry_count; /* Entry count. */ 9562306a36Sopenharmony_ci uint8_t sys_define; 9662306a36Sopenharmony_ci uint8_t entry_status; /* Entry Status. */ 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci uint32_t handle; /* System handle. */ 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci uint32_t reserved_0; 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci __le16 tgt_id; /* Target Idx. */ 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci uint16_t reserved_1; 10562306a36Sopenharmony_ci uint16_t reserved_3; 10662306a36Sopenharmony_ci uint16_t reserved_4; 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci struct scsi_lun lun; /* LUN (LE). */ 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci __le32 control_flags; /* Control Flags. */ 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci uint8_t reserved_2[32]; 11362306a36Sopenharmony_ci}; 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci#define ABORT_IOCB_TYPE_FX00 0x08 /* Abort IOCB status. */ 11762306a36Sopenharmony_cistruct abort_iocb_entry_fx00 { 11862306a36Sopenharmony_ci uint8_t entry_type; /* Entry type. */ 11962306a36Sopenharmony_ci uint8_t entry_count; /* Entry count. */ 12062306a36Sopenharmony_ci uint8_t sys_define; /* System defined. */ 12162306a36Sopenharmony_ci uint8_t entry_status; /* Entry Status. */ 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci uint32_t handle; /* System handle. */ 12462306a36Sopenharmony_ci __le32 reserved_0; 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci __le16 tgt_id_sts; /* Completion status. */ 12762306a36Sopenharmony_ci __le16 options; 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci uint32_t abort_handle; /* System handle. */ 13062306a36Sopenharmony_ci __le32 reserved_2; 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci __le16 req_que_no; 13362306a36Sopenharmony_ci uint8_t reserved_1[38]; 13462306a36Sopenharmony_ci}; 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci#define IOCTL_IOSB_TYPE_FX00 0x0C 13762306a36Sopenharmony_cistruct ioctl_iocb_entry_fx00 { 13862306a36Sopenharmony_ci uint8_t entry_type; /* Entry type. */ 13962306a36Sopenharmony_ci uint8_t entry_count; /* Entry count. */ 14062306a36Sopenharmony_ci uint8_t sys_define; /* System defined. */ 14162306a36Sopenharmony_ci uint8_t entry_status; /* Entry Status. */ 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci uint32_t handle; /* System handle. */ 14462306a36Sopenharmony_ci uint32_t reserved_0; /* System handle. */ 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci uint16_t comp_func_num; 14762306a36Sopenharmony_ci __le16 fw_iotcl_flags; 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci __le32 dataword_r; /* Data word returned */ 15062306a36Sopenharmony_ci uint32_t adapid; /* Adapter ID */ 15162306a36Sopenharmony_ci uint32_t dataword_r_extra; 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci __le32 seq_no; 15462306a36Sopenharmony_ci uint8_t reserved_2[20]; 15562306a36Sopenharmony_ci uint32_t residuallen; 15662306a36Sopenharmony_ci __le32 status; 15762306a36Sopenharmony_ci}; 15862306a36Sopenharmony_ci 15962306a36Sopenharmony_ci#define STATUS_CONT_TYPE_FX00 0x04 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci#define FX00_IOCB_TYPE 0x0B 16262306a36Sopenharmony_cistruct fxdisc_entry_fx00 { 16362306a36Sopenharmony_ci uint8_t entry_type; /* Entry type. */ 16462306a36Sopenharmony_ci uint8_t entry_count; /* Entry count. */ 16562306a36Sopenharmony_ci uint8_t sys_define; /* System Defined. */ 16662306a36Sopenharmony_ci uint8_t entry_status; /* Entry Status. */ 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci uint32_t handle; /* System handle. */ 16962306a36Sopenharmony_ci __le32 reserved_0; /* System handle. */ 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci __le16 func_num; 17262306a36Sopenharmony_ci __le16 req_xfrcnt; 17362306a36Sopenharmony_ci __le16 req_dsdcnt; 17462306a36Sopenharmony_ci __le16 rsp_xfrcnt; 17562306a36Sopenharmony_ci __le16 rsp_dsdcnt; 17662306a36Sopenharmony_ci uint8_t flags; 17762306a36Sopenharmony_ci uint8_t reserved_1; 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci /* 18062306a36Sopenharmony_ci * Use array size 1 below to prevent that Coverity complains about 18162306a36Sopenharmony_ci * the append_dsd64() calls for the two arrays below. 18262306a36Sopenharmony_ci */ 18362306a36Sopenharmony_ci struct dsd64 dseg_rq[1]; 18462306a36Sopenharmony_ci struct dsd64 dseg_rsp[1]; 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_ci __le32 dataword; 18762306a36Sopenharmony_ci __le32 adapid; 18862306a36Sopenharmony_ci __le32 adapid_hi; 18962306a36Sopenharmony_ci __le32 dataword_extra; 19062306a36Sopenharmony_ci}; 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_cistruct qlafx00_tgt_node_info { 19362306a36Sopenharmony_ci uint8_t tgt_node_wwpn[WWN_SIZE]; 19462306a36Sopenharmony_ci uint8_t tgt_node_wwnn[WWN_SIZE]; 19562306a36Sopenharmony_ci uint32_t tgt_node_state; 19662306a36Sopenharmony_ci uint8_t reserved[128]; 19762306a36Sopenharmony_ci uint32_t reserved_1[8]; 19862306a36Sopenharmony_ci uint64_t reserved_2[4]; 19962306a36Sopenharmony_ci} __packed; 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci#define QLAFX00_TGT_NODE_INFO sizeof(struct qlafx00_tgt_node_info) 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci#define QLAFX00_LINK_STATUS_DOWN 0x10 20462306a36Sopenharmony_ci#define QLAFX00_LINK_STATUS_UP 0x11 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ci#define QLAFX00_PORT_SPEED_2G 0x2 20762306a36Sopenharmony_ci#define QLAFX00_PORT_SPEED_4G 0x4 20862306a36Sopenharmony_ci#define QLAFX00_PORT_SPEED_8G 0x8 20962306a36Sopenharmony_ci#define QLAFX00_PORT_SPEED_10G 0xa 21062306a36Sopenharmony_cistruct port_info_data { 21162306a36Sopenharmony_ci uint8_t port_state; 21262306a36Sopenharmony_ci uint8_t port_type; 21362306a36Sopenharmony_ci uint16_t port_identifier; 21462306a36Sopenharmony_ci uint32_t up_port_state; 21562306a36Sopenharmony_ci uint8_t fw_ver_num[32]; 21662306a36Sopenharmony_ci uint8_t portal_attrib; 21762306a36Sopenharmony_ci uint16_t host_option; 21862306a36Sopenharmony_ci uint8_t reset_delay; 21962306a36Sopenharmony_ci uint8_t pdwn_retry_cnt; 22062306a36Sopenharmony_ci uint16_t max_luns2tgt; 22162306a36Sopenharmony_ci uint8_t risc_ver; 22262306a36Sopenharmony_ci uint8_t pconn_option; 22362306a36Sopenharmony_ci uint16_t risc_option; 22462306a36Sopenharmony_ci uint16_t max_frame_len; 22562306a36Sopenharmony_ci uint16_t max_iocb_alloc; 22662306a36Sopenharmony_ci uint16_t exec_throttle; 22762306a36Sopenharmony_ci uint8_t retry_cnt; 22862306a36Sopenharmony_ci uint8_t retry_delay; 22962306a36Sopenharmony_ci uint8_t port_name[8]; 23062306a36Sopenharmony_ci uint8_t port_id[3]; 23162306a36Sopenharmony_ci uint8_t link_status; 23262306a36Sopenharmony_ci uint8_t plink_rate; 23362306a36Sopenharmony_ci uint32_t link_config; 23462306a36Sopenharmony_ci uint16_t adap_haddr; 23562306a36Sopenharmony_ci uint8_t tgt_disc; 23662306a36Sopenharmony_ci uint8_t log_tout; 23762306a36Sopenharmony_ci uint8_t node_name[8]; 23862306a36Sopenharmony_ci uint16_t erisc_opt1; 23962306a36Sopenharmony_ci uint8_t resp_acc_tmr; 24062306a36Sopenharmony_ci uint8_t intr_del_tmr; 24162306a36Sopenharmony_ci uint8_t erisc_opt2; 24262306a36Sopenharmony_ci uint8_t alt_port_name[8]; 24362306a36Sopenharmony_ci uint8_t alt_node_name[8]; 24462306a36Sopenharmony_ci uint8_t link_down_tout; 24562306a36Sopenharmony_ci uint8_t conn_type; 24662306a36Sopenharmony_ci uint8_t fc_fw_mode; 24762306a36Sopenharmony_ci uint32_t uiReserved[48]; 24862306a36Sopenharmony_ci} __packed; 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ci/* OS Type Designations */ 25162306a36Sopenharmony_ci#define OS_TYPE_UNKNOWN 0 25262306a36Sopenharmony_ci#define OS_TYPE_LINUX 2 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ci/* Linux Info */ 25562306a36Sopenharmony_ci#define SYSNAME_LENGTH 128 25662306a36Sopenharmony_ci#define NODENAME_LENGTH 64 25762306a36Sopenharmony_ci#define RELEASE_LENGTH 64 25862306a36Sopenharmony_ci#define VERSION_LENGTH 64 25962306a36Sopenharmony_ci#define MACHINE_LENGTH 64 26062306a36Sopenharmony_ci#define DOMNAME_LENGTH 64 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_cistruct host_system_info { 26362306a36Sopenharmony_ci uint32_t os_type; 26462306a36Sopenharmony_ci char sysname[SYSNAME_LENGTH]; 26562306a36Sopenharmony_ci char nodename[NODENAME_LENGTH]; 26662306a36Sopenharmony_ci char release[RELEASE_LENGTH]; 26762306a36Sopenharmony_ci char version[VERSION_LENGTH]; 26862306a36Sopenharmony_ci char machine[MACHINE_LENGTH]; 26962306a36Sopenharmony_ci char domainname[DOMNAME_LENGTH]; 27062306a36Sopenharmony_ci char hostdriver[VERSION_LENGTH]; 27162306a36Sopenharmony_ci uint32_t reserved[64]; 27262306a36Sopenharmony_ci} __packed; 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_cistruct register_host_info { 27562306a36Sopenharmony_ci struct host_system_info hsi; /* host system info */ 27662306a36Sopenharmony_ci uint64_t utc; /* UTC (system time) */ 27762306a36Sopenharmony_ci uint32_t reserved[64]; /* future additions */ 27862306a36Sopenharmony_ci} __packed; 27962306a36Sopenharmony_ci 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_ci#define QLAFX00_PORT_DATA_INFO (sizeof(struct port_info_data)) 28262306a36Sopenharmony_ci#define QLAFX00_TGT_NODE_LIST_SIZE (sizeof(uint32_t) * 32) 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_cistruct config_info_data { 28562306a36Sopenharmony_ci uint8_t model_num[16]; 28662306a36Sopenharmony_ci uint8_t model_description[80]; 28762306a36Sopenharmony_ci uint8_t reserved0[160]; 28862306a36Sopenharmony_ci uint8_t symbolic_name[64]; 28962306a36Sopenharmony_ci uint8_t serial_num[32]; 29062306a36Sopenharmony_ci uint8_t hw_version[16]; 29162306a36Sopenharmony_ci uint8_t fw_version[16]; 29262306a36Sopenharmony_ci uint8_t uboot_version[16]; 29362306a36Sopenharmony_ci uint8_t fru_serial_num[32]; 29462306a36Sopenharmony_ci 29562306a36Sopenharmony_ci uint8_t fc_port_count; 29662306a36Sopenharmony_ci uint8_t iscsi_port_count; 29762306a36Sopenharmony_ci uint8_t reserved1[2]; 29862306a36Sopenharmony_ci 29962306a36Sopenharmony_ci uint8_t mode; 30062306a36Sopenharmony_ci uint8_t log_level; 30162306a36Sopenharmony_ci uint8_t reserved2[2]; 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_ci uint32_t log_size; 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ci uint8_t tgt_pres_mode; 30662306a36Sopenharmony_ci uint8_t iqn_flags; 30762306a36Sopenharmony_ci uint8_t lun_mapping; 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_ci uint64_t adapter_id; 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_ci uint32_t cluster_key_len; 31262306a36Sopenharmony_ci uint8_t cluster_key[16]; 31362306a36Sopenharmony_ci 31462306a36Sopenharmony_ci uint64_t cluster_master_id; 31562306a36Sopenharmony_ci uint64_t cluster_slave_id; 31662306a36Sopenharmony_ci uint8_t cluster_flags; 31762306a36Sopenharmony_ci uint32_t enabled_capabilities; 31862306a36Sopenharmony_ci uint32_t nominal_temp_value; 31962306a36Sopenharmony_ci} __packed; 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ci#define FXDISC_GET_CONFIG_INFO 0x01 32262306a36Sopenharmony_ci#define FXDISC_GET_PORT_INFO 0x02 32362306a36Sopenharmony_ci#define FXDISC_GET_TGT_NODE_INFO 0x80 32462306a36Sopenharmony_ci#define FXDISC_GET_TGT_NODE_LIST 0x81 32562306a36Sopenharmony_ci#define FXDISC_REG_HOST_INFO 0x99 32662306a36Sopenharmony_ci#define FXDISC_ABORT_IOCTL 0xff 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_ci#define QLAFX00_HBA_ICNTRL_REG 0x20B08 32962306a36Sopenharmony_ci#define QLAFX00_ICR_ENB_MASK 0x80000000 33062306a36Sopenharmony_ci#define QLAFX00_ICR_DIS_MASK 0x7fffffff 33162306a36Sopenharmony_ci#define QLAFX00_HST_RST_REG 0x18264 33262306a36Sopenharmony_ci#define QLAFX00_SOC_TEMP_REG 0x184C4 33362306a36Sopenharmony_ci#define QLAFX00_HST_TO_HBA_REG 0x20A04 33462306a36Sopenharmony_ci#define QLAFX00_HBA_TO_HOST_REG 0x21B70 33562306a36Sopenharmony_ci#define QLAFX00_HST_INT_STS_BITS 0x7 33662306a36Sopenharmony_ci#define QLAFX00_BAR1_BASE_ADDR_REG 0x40018 33762306a36Sopenharmony_ci#define QLAFX00_PEX0_WIN0_BASE_ADDR_REG 0x41824 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_ci#define QLAFX00_INTR_MB_CMPLT 0x1 34062306a36Sopenharmony_ci#define QLAFX00_INTR_RSP_CMPLT 0x2 34162306a36Sopenharmony_ci#define QLAFX00_INTR_ASYNC_CMPLT 0x4 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_ci#define QLAFX00_MBA_SYSTEM_ERR 0x8002 34462306a36Sopenharmony_ci#define QLAFX00_MBA_TEMP_OVER 0x8005 34562306a36Sopenharmony_ci#define QLAFX00_MBA_TEMP_NORM 0x8006 34662306a36Sopenharmony_ci#define QLAFX00_MBA_TEMP_CRIT 0x8007 34762306a36Sopenharmony_ci#define QLAFX00_MBA_LINK_UP 0x8011 34862306a36Sopenharmony_ci#define QLAFX00_MBA_LINK_DOWN 0x8012 34962306a36Sopenharmony_ci#define QLAFX00_MBA_PORT_UPDATE 0x8014 35062306a36Sopenharmony_ci#define QLAFX00_MBA_SHUTDOWN_RQSTD 0x8062 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ci#define SOC_SW_RST_CONTROL_REG_CORE0 0x0020800 35362306a36Sopenharmony_ci#define SOC_FABRIC_RST_CONTROL_REG 0x0020840 35462306a36Sopenharmony_ci#define SOC_FABRIC_CONTROL_REG 0x0020200 35562306a36Sopenharmony_ci#define SOC_FABRIC_CONFIG_REG 0x0020204 35662306a36Sopenharmony_ci#define SOC_PWR_MANAGEMENT_PWR_DOWN_REG 0x001820C 35762306a36Sopenharmony_ci 35862306a36Sopenharmony_ci#define SOC_INTERRUPT_SOURCE_I_CONTROL_REG 0x0020B00 35962306a36Sopenharmony_ci#define SOC_CORE_TIMER_REG 0x0021850 36062306a36Sopenharmony_ci#define SOC_IRQ_ACK_REG 0x00218b4 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci#define CONTINUE_A64_TYPE_FX00 0x03 /* Continuation entry. */ 36362306a36Sopenharmony_ci 36462306a36Sopenharmony_ci#define QLAFX00_SET_HST_INTR(ha, value) \ 36562306a36Sopenharmony_ci wrt_reg_dword((ha)->cregbase + QLAFX00_HST_TO_HBA_REG, \ 36662306a36Sopenharmony_ci value) 36762306a36Sopenharmony_ci 36862306a36Sopenharmony_ci#define QLAFX00_CLR_HST_INTR(ha, value) \ 36962306a36Sopenharmony_ci wrt_reg_dword((ha)->cregbase + QLAFX00_HBA_TO_HOST_REG, \ 37062306a36Sopenharmony_ci ~value) 37162306a36Sopenharmony_ci 37262306a36Sopenharmony_ci#define QLAFX00_RD_INTR_REG(ha) \ 37362306a36Sopenharmony_ci rd_reg_dword((ha)->cregbase + QLAFX00_HBA_TO_HOST_REG) 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci#define QLAFX00_CLR_INTR_REG(ha, value) \ 37662306a36Sopenharmony_ci wrt_reg_dword((ha)->cregbase + QLAFX00_HBA_TO_HOST_REG, \ 37762306a36Sopenharmony_ci ~value) 37862306a36Sopenharmony_ci 37962306a36Sopenharmony_ci#define QLAFX00_SET_HBA_SOC_REG(ha, off, val)\ 38062306a36Sopenharmony_ci wrt_reg_dword((ha)->cregbase + off, val) 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci#define QLAFX00_GET_HBA_SOC_REG(ha, off)\ 38362306a36Sopenharmony_ci rd_reg_dword((ha)->cregbase + off) 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_ci#define QLAFX00_HBA_RST_REG(ha, val)\ 38662306a36Sopenharmony_ci wrt_reg_dword((ha)->cregbase + QLAFX00_HST_RST_REG, val) 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_ci#define QLAFX00_RD_ICNTRL_REG(ha) \ 38962306a36Sopenharmony_ci rd_reg_dword((ha)->cregbase + QLAFX00_HBA_ICNTRL_REG) 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_ci#define QLAFX00_ENABLE_ICNTRL_REG(ha) \ 39262306a36Sopenharmony_ci wrt_reg_dword((ha)->cregbase + QLAFX00_HBA_ICNTRL_REG, \ 39362306a36Sopenharmony_ci (QLAFX00_GET_HBA_SOC_REG(ha, QLAFX00_HBA_ICNTRL_REG) | \ 39462306a36Sopenharmony_ci QLAFX00_ICR_ENB_MASK)) 39562306a36Sopenharmony_ci 39662306a36Sopenharmony_ci#define QLAFX00_DISABLE_ICNTRL_REG(ha) \ 39762306a36Sopenharmony_ci wrt_reg_dword((ha)->cregbase + QLAFX00_HBA_ICNTRL_REG, \ 39862306a36Sopenharmony_ci (QLAFX00_GET_HBA_SOC_REG(ha, QLAFX00_HBA_ICNTRL_REG) & \ 39962306a36Sopenharmony_ci QLAFX00_ICR_DIS_MASK)) 40062306a36Sopenharmony_ci 40162306a36Sopenharmony_ci#define QLAFX00_RD_REG(ha, off) \ 40262306a36Sopenharmony_ci rd_reg_dword((ha)->cregbase + off) 40362306a36Sopenharmony_ci 40462306a36Sopenharmony_ci#define QLAFX00_WR_REG(ha, off, val) \ 40562306a36Sopenharmony_ci wrt_reg_dword((ha)->cregbase + off, val) 40662306a36Sopenharmony_ci 40762306a36Sopenharmony_cistruct qla_mt_iocb_rqst_fx00 { 40862306a36Sopenharmony_ci __le32 reserved_0; 40962306a36Sopenharmony_ci 41062306a36Sopenharmony_ci __le16 func_type; 41162306a36Sopenharmony_ci uint8_t flags; 41262306a36Sopenharmony_ci uint8_t reserved_1; 41362306a36Sopenharmony_ci 41462306a36Sopenharmony_ci __le32 dataword; 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci __le32 adapid; 41762306a36Sopenharmony_ci __le32 adapid_hi; 41862306a36Sopenharmony_ci 41962306a36Sopenharmony_ci __le32 dataword_extra; 42062306a36Sopenharmony_ci 42162306a36Sopenharmony_ci __le16 req_len; 42262306a36Sopenharmony_ci __le16 reserved_2; 42362306a36Sopenharmony_ci 42462306a36Sopenharmony_ci __le16 rsp_len; 42562306a36Sopenharmony_ci __le16 reserved_3; 42662306a36Sopenharmony_ci}; 42762306a36Sopenharmony_ci 42862306a36Sopenharmony_cistruct qla_mt_iocb_rsp_fx00 { 42962306a36Sopenharmony_ci uint32_t reserved_1; 43062306a36Sopenharmony_ci 43162306a36Sopenharmony_ci uint16_t func_type; 43262306a36Sopenharmony_ci __le16 ioctl_flags; 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci __le32 ioctl_data; 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ci uint32_t adapid; 43762306a36Sopenharmony_ci uint32_t adapid_hi; 43862306a36Sopenharmony_ci 43962306a36Sopenharmony_ci uint32_t reserved_2; 44062306a36Sopenharmony_ci __le32 seq_number; 44162306a36Sopenharmony_ci 44262306a36Sopenharmony_ci uint8_t reserved_3[20]; 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci int32_t res_count; 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_ci __le32 status; 44762306a36Sopenharmony_ci}; 44862306a36Sopenharmony_ci 44962306a36Sopenharmony_ci 45062306a36Sopenharmony_ci#define MAILBOX_REGISTER_COUNT_FX00 16 45162306a36Sopenharmony_ci#define AEN_MAILBOX_REGISTER_COUNT_FX00 8 45262306a36Sopenharmony_ci#define MAX_FIBRE_DEVICES_FX00 512 45362306a36Sopenharmony_ci#define MAX_LUNS_FX00 0x1024 45462306a36Sopenharmony_ci#define MAX_TARGETS_FX00 MAX_ISA_DEVICES 45562306a36Sopenharmony_ci#define REQUEST_ENTRY_CNT_FX00 512 /* Number of request entries. */ 45662306a36Sopenharmony_ci#define RESPONSE_ENTRY_CNT_FX00 256 /* Number of response entries.*/ 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_ci/* 45962306a36Sopenharmony_ci * Firmware state codes for QLAFX00 adapters 46062306a36Sopenharmony_ci */ 46162306a36Sopenharmony_ci#define FSTATE_FX00_CONFIG_WAIT 0x0000 /* Waiting for driver to issue 46262306a36Sopenharmony_ci * Initialize FW Mbox cmd 46362306a36Sopenharmony_ci */ 46462306a36Sopenharmony_ci#define FSTATE_FX00_INITIALIZED 0x1000 /* FW has been initialized by 46562306a36Sopenharmony_ci * the driver 46662306a36Sopenharmony_ci */ 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci#define FX00_DEF_RATOV 10 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_cistruct mr_data_fx00 { 47162306a36Sopenharmony_ci uint8_t symbolic_name[64]; 47262306a36Sopenharmony_ci uint8_t serial_num[32]; 47362306a36Sopenharmony_ci uint8_t hw_version[16]; 47462306a36Sopenharmony_ci uint8_t fw_version[16]; 47562306a36Sopenharmony_ci uint8_t uboot_version[16]; 47662306a36Sopenharmony_ci uint8_t fru_serial_num[32]; 47762306a36Sopenharmony_ci fc_port_t fcport; /* fcport used for requests 47862306a36Sopenharmony_ci * that are not linked 47962306a36Sopenharmony_ci * to a particular target 48062306a36Sopenharmony_ci */ 48162306a36Sopenharmony_ci uint8_t fw_hbt_en; 48262306a36Sopenharmony_ci uint8_t fw_hbt_cnt; 48362306a36Sopenharmony_ci uint8_t fw_hbt_miss_cnt; 48462306a36Sopenharmony_ci uint32_t old_fw_hbt_cnt; 48562306a36Sopenharmony_ci uint16_t fw_reset_timer_tick; 48662306a36Sopenharmony_ci uint8_t fw_reset_timer_exp; 48762306a36Sopenharmony_ci uint16_t fw_critemp_timer_tick; 48862306a36Sopenharmony_ci uint32_t old_aenmbx0_state; 48962306a36Sopenharmony_ci uint32_t critical_temperature; 49062306a36Sopenharmony_ci bool extended_io_enabled; 49162306a36Sopenharmony_ci bool host_info_resend; 49262306a36Sopenharmony_ci uint8_t hinfo_resend_timer_tick; 49362306a36Sopenharmony_ci}; 49462306a36Sopenharmony_ci 49562306a36Sopenharmony_ci#define QLAFX00_EXTENDED_IO_EN_MASK 0x20 49662306a36Sopenharmony_ci 49762306a36Sopenharmony_ci/* 49862306a36Sopenharmony_ci * SoC Junction Temperature is stored in 49962306a36Sopenharmony_ci * bits 9:1 of SoC Junction Temperature Register 50062306a36Sopenharmony_ci * in a firmware specific format format. 50162306a36Sopenharmony_ci * To get the temperature in Celsius degrees 50262306a36Sopenharmony_ci * the value from this bitfiled should be converted 50362306a36Sopenharmony_ci * using this formula: 50462306a36Sopenharmony_ci * Temperature (degrees C) = ((3,153,000 - (10,000 * X)) / 13,825) 50562306a36Sopenharmony_ci * where X is the bit field value 50662306a36Sopenharmony_ci * this macro reads the register, extracts the bitfield value, 50762306a36Sopenharmony_ci * performs the calcualtions and returns temperature in Celsius 50862306a36Sopenharmony_ci */ 50962306a36Sopenharmony_ci#define QLAFX00_GET_TEMPERATURE(ha) ((3153000 - (10000 * \ 51062306a36Sopenharmony_ci ((QLAFX00_RD_REG(ha, QLAFX00_SOC_TEMP_REG) & 0x3FE) >> 1))) / 13825) 51162306a36Sopenharmony_ci 51262306a36Sopenharmony_ci 51362306a36Sopenharmony_ci#define QLAFX00_LOOP_DOWN_TIME 615 /* 600 */ 51462306a36Sopenharmony_ci#define QLAFX00_HEARTBEAT_INTERVAL 6 /* number of seconds */ 51562306a36Sopenharmony_ci#define QLAFX00_HEARTBEAT_MISS_CNT 3 /* number of miss */ 51662306a36Sopenharmony_ci#define QLAFX00_RESET_INTERVAL 120 /* number of seconds */ 51762306a36Sopenharmony_ci#define QLAFX00_MAX_RESET_INTERVAL 600 /* number of seconds */ 51862306a36Sopenharmony_ci#define QLAFX00_CRITEMP_INTERVAL 60 /* number of seconds */ 51962306a36Sopenharmony_ci#define QLAFX00_HINFO_RESEND_INTERVAL 60 /* number of seconds */ 52062306a36Sopenharmony_ci 52162306a36Sopenharmony_ci#define QLAFX00_CRITEMP_THRSHLD 80 /* Celsius degrees */ 52262306a36Sopenharmony_ci 52362306a36Sopenharmony_ci/* Max conncurrent IOs that can be queued */ 52462306a36Sopenharmony_ci#define QLAFX00_MAX_CANQUEUE 1024 52562306a36Sopenharmony_ci 52662306a36Sopenharmony_ci/* IOCTL IOCB abort success */ 52762306a36Sopenharmony_ci#define QLAFX00_IOCTL_ICOB_ABORT_SUCCESS 0x68 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci#endif 530