162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2015 Linaro Ltd. 462306a36Sopenharmony_ci * Copyright (c) 2015 Hisilicon Limited. 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef _HISI_SAS_H_ 862306a36Sopenharmony_ci#define _HISI_SAS_H_ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#include <linux/acpi.h> 1162306a36Sopenharmony_ci#include <linux/blk-mq.h> 1262306a36Sopenharmony_ci#include <linux/blk-mq-pci.h> 1362306a36Sopenharmony_ci#include <linux/clk.h> 1462306a36Sopenharmony_ci#include <linux/debugfs.h> 1562306a36Sopenharmony_ci#include <linux/dmapool.h> 1662306a36Sopenharmony_ci#include <linux/iopoll.h> 1762306a36Sopenharmony_ci#include <linux/irq.h> 1862306a36Sopenharmony_ci#include <linux/lcm.h> 1962306a36Sopenharmony_ci#include <linux/libata.h> 2062306a36Sopenharmony_ci#include <linux/mfd/syscon.h> 2162306a36Sopenharmony_ci#include <linux/module.h> 2262306a36Sopenharmony_ci#include <linux/of_address.h> 2362306a36Sopenharmony_ci#include <linux/pci.h> 2462306a36Sopenharmony_ci#include <linux/platform_device.h> 2562306a36Sopenharmony_ci#include <linux/pm_runtime.h> 2662306a36Sopenharmony_ci#include <linux/property.h> 2762306a36Sopenharmony_ci#include <linux/regmap.h> 2862306a36Sopenharmony_ci#include <linux/timer.h> 2962306a36Sopenharmony_ci#include <scsi/sas_ata.h> 3062306a36Sopenharmony_ci#include <scsi/libsas.h> 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci#define HISI_SAS_MAX_PHYS 9 3362306a36Sopenharmony_ci#define HISI_SAS_MAX_QUEUES 32 3462306a36Sopenharmony_ci#define HISI_SAS_QUEUE_SLOTS 4096 3562306a36Sopenharmony_ci#define HISI_SAS_MAX_ITCT_ENTRIES 1024 3662306a36Sopenharmony_ci#define HISI_SAS_MAX_DEVICES HISI_SAS_MAX_ITCT_ENTRIES 3762306a36Sopenharmony_ci#define HISI_SAS_RESETTING_BIT 0 3862306a36Sopenharmony_ci#define HISI_SAS_REJECT_CMD_BIT 1 3962306a36Sopenharmony_ci#define HISI_SAS_PM_BIT 2 4062306a36Sopenharmony_ci#define HISI_SAS_HW_FAULT_BIT 3 4162306a36Sopenharmony_ci#define HISI_SAS_MAX_COMMANDS (HISI_SAS_QUEUE_SLOTS) 4262306a36Sopenharmony_ci#define HISI_SAS_RESERVED_IPTT 96 4362306a36Sopenharmony_ci#define HISI_SAS_UNRESERVED_IPTT \ 4462306a36Sopenharmony_ci (HISI_SAS_MAX_COMMANDS - HISI_SAS_RESERVED_IPTT) 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci#define HISI_SAS_IOST_ITCT_CACHE_NUM 64 4762306a36Sopenharmony_ci#define HISI_SAS_IOST_ITCT_CACHE_DW_SZ 10 4862306a36Sopenharmony_ci#define HISI_SAS_FIFO_DATA_DW_SIZE 32 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#define HISI_SAS_STATUS_BUF_SZ (sizeof(struct hisi_sas_status_buffer)) 5162306a36Sopenharmony_ci#define HISI_SAS_COMMAND_TABLE_SZ (sizeof(union hisi_sas_command_table)) 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci#define hisi_sas_status_buf_addr(buf) \ 5462306a36Sopenharmony_ci ((buf) + offsetof(struct hisi_sas_slot_buf_table, status_buffer)) 5562306a36Sopenharmony_ci#define hisi_sas_status_buf_addr_mem(slot) hisi_sas_status_buf_addr((slot)->buf) 5662306a36Sopenharmony_ci#define hisi_sas_status_buf_addr_dma(slot) \ 5762306a36Sopenharmony_ci hisi_sas_status_buf_addr((slot)->buf_dma) 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#define hisi_sas_cmd_hdr_addr(buf) \ 6062306a36Sopenharmony_ci ((buf) + offsetof(struct hisi_sas_slot_buf_table, command_header)) 6162306a36Sopenharmony_ci#define hisi_sas_cmd_hdr_addr_mem(slot) hisi_sas_cmd_hdr_addr((slot)->buf) 6262306a36Sopenharmony_ci#define hisi_sas_cmd_hdr_addr_dma(slot) hisi_sas_cmd_hdr_addr((slot)->buf_dma) 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#define hisi_sas_sge_addr(buf) \ 6562306a36Sopenharmony_ci ((buf) + offsetof(struct hisi_sas_slot_buf_table, sge_page)) 6662306a36Sopenharmony_ci#define hisi_sas_sge_addr_mem(slot) hisi_sas_sge_addr((slot)->buf) 6762306a36Sopenharmony_ci#define hisi_sas_sge_addr_dma(slot) hisi_sas_sge_addr((slot)->buf_dma) 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci#define hisi_sas_sge_dif_addr(buf) \ 7062306a36Sopenharmony_ci ((buf) + offsetof(struct hisi_sas_slot_dif_buf_table, sge_dif_page)) 7162306a36Sopenharmony_ci#define hisi_sas_sge_dif_addr_mem(slot) hisi_sas_sge_dif_addr((slot)->buf) 7262306a36Sopenharmony_ci#define hisi_sas_sge_dif_addr_dma(slot) hisi_sas_sge_dif_addr((slot)->buf_dma) 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci#define HISI_SAS_MAX_SSP_RESP_SZ (sizeof(struct ssp_frame_hdr) + 1024) 7562306a36Sopenharmony_ci#define HISI_SAS_MAX_SMP_RESP_SZ 1028 7662306a36Sopenharmony_ci#define HISI_SAS_MAX_STP_RESP_SZ 28 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci#define HISI_SAS_SATA_PROTOCOL_NONDATA 0x1 7962306a36Sopenharmony_ci#define HISI_SAS_SATA_PROTOCOL_PIO 0x2 8062306a36Sopenharmony_ci#define HISI_SAS_SATA_PROTOCOL_DMA 0x4 8162306a36Sopenharmony_ci#define HISI_SAS_SATA_PROTOCOL_FPDMA 0x8 8262306a36Sopenharmony_ci#define HISI_SAS_SATA_PROTOCOL_ATAPI 0x10 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define HISI_SAS_DIF_PROT_MASK (SHOST_DIF_TYPE1_PROTECTION | \ 8562306a36Sopenharmony_ci SHOST_DIF_TYPE2_PROTECTION | \ 8662306a36Sopenharmony_ci SHOST_DIF_TYPE3_PROTECTION) 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#define HISI_SAS_DIX_PROT_MASK (SHOST_DIX_TYPE1_PROTECTION | \ 8962306a36Sopenharmony_ci SHOST_DIX_TYPE2_PROTECTION | \ 9062306a36Sopenharmony_ci SHOST_DIX_TYPE3_PROTECTION) 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci#define HISI_SAS_PROT_MASK (HISI_SAS_DIF_PROT_MASK | HISI_SAS_DIX_PROT_MASK) 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci#define HISI_SAS_WAIT_PHYUP_TIMEOUT (30 * HZ) 9562306a36Sopenharmony_ci#define HISI_SAS_CLEAR_ITCT_TIMEOUT (20 * HZ) 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_cistruct hisi_hba; 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_cienum { 10062306a36Sopenharmony_ci PORT_TYPE_SAS = (1U << 1), 10162306a36Sopenharmony_ci PORT_TYPE_SATA = (1U << 0), 10262306a36Sopenharmony_ci}; 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_cienum dev_status { 10562306a36Sopenharmony_ci HISI_SAS_DEV_INIT, 10662306a36Sopenharmony_ci HISI_SAS_DEV_NORMAL, 10762306a36Sopenharmony_ci HISI_SAS_DEV_NCQ_ERR, 10862306a36Sopenharmony_ci}; 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_cienum { 11162306a36Sopenharmony_ci HISI_SAS_INT_ABT_CMD = 0, 11262306a36Sopenharmony_ci HISI_SAS_INT_ABT_DEV = 1, 11362306a36Sopenharmony_ci}; 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_cienum hisi_sas_dev_type { 11662306a36Sopenharmony_ci HISI_SAS_DEV_TYPE_STP = 0, 11762306a36Sopenharmony_ci HISI_SAS_DEV_TYPE_SSP, 11862306a36Sopenharmony_ci HISI_SAS_DEV_TYPE_SATA, 11962306a36Sopenharmony_ci}; 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_cistruct hisi_sas_hw_error { 12262306a36Sopenharmony_ci u32 irq_msk; 12362306a36Sopenharmony_ci u32 msk; 12462306a36Sopenharmony_ci int shift; 12562306a36Sopenharmony_ci const char *msg; 12662306a36Sopenharmony_ci int reg; 12762306a36Sopenharmony_ci const struct hisi_sas_hw_error *sub; 12862306a36Sopenharmony_ci}; 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_cistruct hisi_sas_rst { 13162306a36Sopenharmony_ci struct hisi_hba *hisi_hba; 13262306a36Sopenharmony_ci struct completion *completion; 13362306a36Sopenharmony_ci struct work_struct work; 13462306a36Sopenharmony_ci bool done; 13562306a36Sopenharmony_ci}; 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci#define HISI_SAS_RST_WORK_INIT(r, c) \ 13862306a36Sopenharmony_ci { .hisi_hba = hisi_hba, \ 13962306a36Sopenharmony_ci .completion = &c, \ 14062306a36Sopenharmony_ci .work = __WORK_INITIALIZER(r.work, \ 14162306a36Sopenharmony_ci hisi_sas_sync_rst_work_handler), \ 14262306a36Sopenharmony_ci .done = false, \ 14362306a36Sopenharmony_ci } 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ci#define HISI_SAS_DECLARE_RST_WORK_ON_STACK(r) \ 14662306a36Sopenharmony_ci DECLARE_COMPLETION_ONSTACK(c); \ 14762306a36Sopenharmony_ci struct hisi_sas_rst r = HISI_SAS_RST_WORK_INIT(r, c) 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_cienum hisi_sas_bit_err_type { 15062306a36Sopenharmony_ci HISI_SAS_ERR_SINGLE_BIT_ECC = 0x0, 15162306a36Sopenharmony_ci HISI_SAS_ERR_MULTI_BIT_ECC = 0x1, 15262306a36Sopenharmony_ci}; 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_cienum hisi_sas_phy_event { 15562306a36Sopenharmony_ci HISI_PHYE_PHY_UP = 0U, 15662306a36Sopenharmony_ci HISI_PHYE_LINK_RESET, 15762306a36Sopenharmony_ci HISI_PHYE_PHY_UP_PM, 15862306a36Sopenharmony_ci HISI_PHYES_NUM, 15962306a36Sopenharmony_ci}; 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_cistruct hisi_sas_debugfs_fifo { 16262306a36Sopenharmony_ci u32 signal_sel; 16362306a36Sopenharmony_ci u32 dump_msk; 16462306a36Sopenharmony_ci u32 dump_mode; 16562306a36Sopenharmony_ci u32 trigger; 16662306a36Sopenharmony_ci u32 trigger_msk; 16762306a36Sopenharmony_ci u32 trigger_mode; 16862306a36Sopenharmony_ci u32 rd_data[HISI_SAS_FIFO_DATA_DW_SIZE]; 16962306a36Sopenharmony_ci}; 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_cistruct hisi_sas_phy { 17262306a36Sopenharmony_ci struct work_struct works[HISI_PHYES_NUM]; 17362306a36Sopenharmony_ci struct hisi_hba *hisi_hba; 17462306a36Sopenharmony_ci struct hisi_sas_port *port; 17562306a36Sopenharmony_ci struct asd_sas_phy sas_phy; 17662306a36Sopenharmony_ci struct sas_identify identify; 17762306a36Sopenharmony_ci struct completion *reset_completion; 17862306a36Sopenharmony_ci struct timer_list timer; 17962306a36Sopenharmony_ci spinlock_t lock; 18062306a36Sopenharmony_ci u64 port_id; /* from hw */ 18162306a36Sopenharmony_ci u64 frame_rcvd_size; 18262306a36Sopenharmony_ci u8 frame_rcvd[32]; 18362306a36Sopenharmony_ci u8 phy_attached; 18462306a36Sopenharmony_ci u8 in_reset; 18562306a36Sopenharmony_ci u8 reserved[2]; 18662306a36Sopenharmony_ci u32 phy_type; 18762306a36Sopenharmony_ci u32 code_violation_err_count; 18862306a36Sopenharmony_ci enum sas_linkrate minimum_linkrate; 18962306a36Sopenharmony_ci enum sas_linkrate maximum_linkrate; 19062306a36Sopenharmony_ci int enable; 19162306a36Sopenharmony_ci int wait_phyup_cnt; 19262306a36Sopenharmony_ci atomic_t down_cnt; 19362306a36Sopenharmony_ci 19462306a36Sopenharmony_ci /* Trace FIFO */ 19562306a36Sopenharmony_ci struct hisi_sas_debugfs_fifo fifo; 19662306a36Sopenharmony_ci}; 19762306a36Sopenharmony_ci 19862306a36Sopenharmony_cistruct hisi_sas_port { 19962306a36Sopenharmony_ci struct asd_sas_port sas_port; 20062306a36Sopenharmony_ci u8 port_attached; 20162306a36Sopenharmony_ci u8 id; /* from hw */ 20262306a36Sopenharmony_ci}; 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_cistruct hisi_sas_cq { 20562306a36Sopenharmony_ci struct hisi_hba *hisi_hba; 20662306a36Sopenharmony_ci const struct cpumask *irq_mask; 20762306a36Sopenharmony_ci int rd_point; 20862306a36Sopenharmony_ci int id; 20962306a36Sopenharmony_ci int irq_no; 21062306a36Sopenharmony_ci spinlock_t poll_lock; 21162306a36Sopenharmony_ci}; 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_cistruct hisi_sas_dq { 21462306a36Sopenharmony_ci struct hisi_hba *hisi_hba; 21562306a36Sopenharmony_ci struct list_head list; 21662306a36Sopenharmony_ci spinlock_t lock; 21762306a36Sopenharmony_ci int wr_point; 21862306a36Sopenharmony_ci int id; 21962306a36Sopenharmony_ci}; 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_cistruct hisi_sas_device { 22262306a36Sopenharmony_ci struct hisi_hba *hisi_hba; 22362306a36Sopenharmony_ci struct domain_device *sas_device; 22462306a36Sopenharmony_ci struct completion *completion; 22562306a36Sopenharmony_ci struct hisi_sas_dq *dq; 22662306a36Sopenharmony_ci struct list_head list; 22762306a36Sopenharmony_ci enum sas_device_type dev_type; 22862306a36Sopenharmony_ci enum dev_status dev_status; 22962306a36Sopenharmony_ci int device_id; 23062306a36Sopenharmony_ci int sata_idx; 23162306a36Sopenharmony_ci spinlock_t lock; /* For protecting slots */ 23262306a36Sopenharmony_ci}; 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_cistruct hisi_sas_slot { 23562306a36Sopenharmony_ci struct list_head entry; 23662306a36Sopenharmony_ci struct list_head delivery; 23762306a36Sopenharmony_ci struct sas_task *task; 23862306a36Sopenharmony_ci struct hisi_sas_port *port; 23962306a36Sopenharmony_ci u64 n_elem; 24062306a36Sopenharmony_ci u64 n_elem_dif; 24162306a36Sopenharmony_ci int dlvry_queue; 24262306a36Sopenharmony_ci int dlvry_queue_slot; 24362306a36Sopenharmony_ci int cmplt_queue; 24462306a36Sopenharmony_ci int cmplt_queue_slot; 24562306a36Sopenharmony_ci int abort; 24662306a36Sopenharmony_ci int ready; 24762306a36Sopenharmony_ci int device_id; 24862306a36Sopenharmony_ci void *cmd_hdr; 24962306a36Sopenharmony_ci dma_addr_t cmd_hdr_dma; 25062306a36Sopenharmony_ci struct timer_list internal_abort_timer; 25162306a36Sopenharmony_ci bool is_internal; 25262306a36Sopenharmony_ci struct sas_tmf_task *tmf; 25362306a36Sopenharmony_ci /* Do not reorder/change members after here */ 25462306a36Sopenharmony_ci void *buf; 25562306a36Sopenharmony_ci dma_addr_t buf_dma; 25662306a36Sopenharmony_ci u16 idx; 25762306a36Sopenharmony_ci}; 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_cistruct hisi_sas_iost_itct_cache { 26062306a36Sopenharmony_ci u32 data[HISI_SAS_IOST_ITCT_CACHE_DW_SZ]; 26162306a36Sopenharmony_ci}; 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_cienum hisi_sas_debugfs_reg_array_member { 26462306a36Sopenharmony_ci DEBUGFS_GLOBAL = 0, 26562306a36Sopenharmony_ci DEBUGFS_AXI, 26662306a36Sopenharmony_ci DEBUGFS_RAS, 26762306a36Sopenharmony_ci DEBUGFS_REGS_NUM 26862306a36Sopenharmony_ci}; 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_cienum hisi_sas_debugfs_cache_type { 27162306a36Sopenharmony_ci HISI_SAS_ITCT_CACHE, 27262306a36Sopenharmony_ci HISI_SAS_IOST_CACHE, 27362306a36Sopenharmony_ci}; 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_cienum hisi_sas_debugfs_bist_ffe_cfg { 27662306a36Sopenharmony_ci FFE_SAS_1_5_GBPS, 27762306a36Sopenharmony_ci FFE_SAS_3_0_GBPS, 27862306a36Sopenharmony_ci FFE_SAS_6_0_GBPS, 27962306a36Sopenharmony_ci FFE_SAS_12_0_GBPS, 28062306a36Sopenharmony_ci FFE_RESV, 28162306a36Sopenharmony_ci FFE_SATA_1_5_GBPS, 28262306a36Sopenharmony_ci FFE_SATA_3_0_GBPS, 28362306a36Sopenharmony_ci FFE_SATA_6_0_GBPS, 28462306a36Sopenharmony_ci FFE_CFG_MAX 28562306a36Sopenharmony_ci}; 28662306a36Sopenharmony_ci 28762306a36Sopenharmony_cienum hisi_sas_debugfs_bist_fixed_code { 28862306a36Sopenharmony_ci FIXED_CODE, 28962306a36Sopenharmony_ci FIXED_CODE_1, 29062306a36Sopenharmony_ci FIXED_CODE_MAX 29162306a36Sopenharmony_ci}; 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_cienum { 29462306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_PRBS7, 29562306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_PRBS23, 29662306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_PRBS31, 29762306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_JTPAT, 29862306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_CJTPAT, 29962306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_SCRAMBED_0, 30062306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_TRAIN, 30162306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_TRAIN_DONE, 30262306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_HFTP, 30362306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_MFTP, 30462306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_LFTP, 30562306a36Sopenharmony_ci HISI_SAS_BIST_CODE_MODE_FIXED_DATA, 30662306a36Sopenharmony_ci}; 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_cistruct hisi_sas_hw { 30962306a36Sopenharmony_ci int (*hw_init)(struct hisi_hba *hisi_hba); 31062306a36Sopenharmony_ci int (*interrupt_preinit)(struct hisi_hba *hisi_hba); 31162306a36Sopenharmony_ci void (*setup_itct)(struct hisi_hba *hisi_hba, 31262306a36Sopenharmony_ci struct hisi_sas_device *device); 31362306a36Sopenharmony_ci int (*slot_index_alloc)(struct hisi_hba *hisi_hba, 31462306a36Sopenharmony_ci struct domain_device *device); 31562306a36Sopenharmony_ci struct hisi_sas_device *(*alloc_dev)(struct domain_device *device); 31662306a36Sopenharmony_ci void (*sl_notify_ssp)(struct hisi_hba *hisi_hba, int phy_no); 31762306a36Sopenharmony_ci void (*start_delivery)(struct hisi_sas_dq *dq); 31862306a36Sopenharmony_ci void (*prep_ssp)(struct hisi_hba *hisi_hba, 31962306a36Sopenharmony_ci struct hisi_sas_slot *slot); 32062306a36Sopenharmony_ci void (*prep_smp)(struct hisi_hba *hisi_hba, 32162306a36Sopenharmony_ci struct hisi_sas_slot *slot); 32262306a36Sopenharmony_ci void (*prep_stp)(struct hisi_hba *hisi_hba, 32362306a36Sopenharmony_ci struct hisi_sas_slot *slot); 32462306a36Sopenharmony_ci void (*prep_abort)(struct hisi_hba *hisi_hba, 32562306a36Sopenharmony_ci struct hisi_sas_slot *slot); 32662306a36Sopenharmony_ci void (*phys_init)(struct hisi_hba *hisi_hba); 32762306a36Sopenharmony_ci void (*phy_start)(struct hisi_hba *hisi_hba, int phy_no); 32862306a36Sopenharmony_ci void (*phy_disable)(struct hisi_hba *hisi_hba, int phy_no); 32962306a36Sopenharmony_ci void (*phy_hard_reset)(struct hisi_hba *hisi_hba, int phy_no); 33062306a36Sopenharmony_ci void (*get_events)(struct hisi_hba *hisi_hba, int phy_no); 33162306a36Sopenharmony_ci void (*phy_set_linkrate)(struct hisi_hba *hisi_hba, int phy_no, 33262306a36Sopenharmony_ci struct sas_phy_linkrates *linkrates); 33362306a36Sopenharmony_ci enum sas_linkrate (*phy_get_max_linkrate)(void); 33462306a36Sopenharmony_ci int (*clear_itct)(struct hisi_hba *hisi_hba, 33562306a36Sopenharmony_ci struct hisi_sas_device *dev); 33662306a36Sopenharmony_ci void (*free_device)(struct hisi_sas_device *sas_dev); 33762306a36Sopenharmony_ci int (*get_wideport_bitmap)(struct hisi_hba *hisi_hba, int port_id); 33862306a36Sopenharmony_ci void (*dereg_device)(struct hisi_hba *hisi_hba, 33962306a36Sopenharmony_ci struct domain_device *device); 34062306a36Sopenharmony_ci int (*soft_reset)(struct hisi_hba *hisi_hba); 34162306a36Sopenharmony_ci u32 (*get_phys_state)(struct hisi_hba *hisi_hba); 34262306a36Sopenharmony_ci int (*write_gpio)(struct hisi_hba *hisi_hba, u8 reg_type, 34362306a36Sopenharmony_ci u8 reg_index, u8 reg_count, u8 *write_data); 34462306a36Sopenharmony_ci void (*wait_cmds_complete_timeout)(struct hisi_hba *hisi_hba, 34562306a36Sopenharmony_ci int delay_ms, int timeout_ms); 34662306a36Sopenharmony_ci void (*debugfs_snapshot_regs)(struct hisi_hba *hisi_hba); 34762306a36Sopenharmony_ci int complete_hdr_size; 34862306a36Sopenharmony_ci const struct scsi_host_template *sht; 34962306a36Sopenharmony_ci}; 35062306a36Sopenharmony_ci 35162306a36Sopenharmony_ci#define HISI_SAS_MAX_DEBUGFS_DUMP (50) 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_cistruct hisi_sas_debugfs_cq { 35462306a36Sopenharmony_ci struct hisi_sas_cq *cq; 35562306a36Sopenharmony_ci void *complete_hdr; 35662306a36Sopenharmony_ci}; 35762306a36Sopenharmony_ci 35862306a36Sopenharmony_cistruct hisi_sas_debugfs_dq { 35962306a36Sopenharmony_ci struct hisi_sas_dq *dq; 36062306a36Sopenharmony_ci struct hisi_sas_cmd_hdr *hdr; 36162306a36Sopenharmony_ci}; 36262306a36Sopenharmony_ci 36362306a36Sopenharmony_cistruct hisi_sas_debugfs_regs { 36462306a36Sopenharmony_ci struct hisi_hba *hisi_hba; 36562306a36Sopenharmony_ci u32 *data; 36662306a36Sopenharmony_ci}; 36762306a36Sopenharmony_ci 36862306a36Sopenharmony_cistruct hisi_sas_debugfs_port { 36962306a36Sopenharmony_ci struct hisi_sas_phy *phy; 37062306a36Sopenharmony_ci u32 *data; 37162306a36Sopenharmony_ci}; 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_cistruct hisi_sas_debugfs_iost { 37462306a36Sopenharmony_ci struct hisi_sas_iost *iost; 37562306a36Sopenharmony_ci}; 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_cistruct hisi_sas_debugfs_itct { 37862306a36Sopenharmony_ci struct hisi_sas_itct *itct; 37962306a36Sopenharmony_ci}; 38062306a36Sopenharmony_ci 38162306a36Sopenharmony_cistruct hisi_sas_debugfs_iost_cache { 38262306a36Sopenharmony_ci struct hisi_sas_iost_itct_cache *cache; 38362306a36Sopenharmony_ci}; 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_cistruct hisi_sas_debugfs_itct_cache { 38662306a36Sopenharmony_ci struct hisi_sas_iost_itct_cache *cache; 38762306a36Sopenharmony_ci}; 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_cistruct hisi_hba { 39062306a36Sopenharmony_ci /* This must be the first element, used by SHOST_TO_SAS_HA */ 39162306a36Sopenharmony_ci struct sas_ha_struct *p; 39262306a36Sopenharmony_ci 39362306a36Sopenharmony_ci struct platform_device *platform_dev; 39462306a36Sopenharmony_ci struct pci_dev *pci_dev; 39562306a36Sopenharmony_ci struct device *dev; 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci int prot_mask; 39862306a36Sopenharmony_ci 39962306a36Sopenharmony_ci void __iomem *regs; 40062306a36Sopenharmony_ci void __iomem *sgpio_regs; 40162306a36Sopenharmony_ci struct regmap *ctrl; 40262306a36Sopenharmony_ci u32 ctrl_reset_reg; 40362306a36Sopenharmony_ci u32 ctrl_reset_sts_reg; 40462306a36Sopenharmony_ci u32 ctrl_clock_ena_reg; 40562306a36Sopenharmony_ci u32 refclk_frequency_mhz; 40662306a36Sopenharmony_ci u8 sas_addr[SAS_ADDR_SIZE]; 40762306a36Sopenharmony_ci 40862306a36Sopenharmony_ci int *irq_map; /* v2 hw */ 40962306a36Sopenharmony_ci 41062306a36Sopenharmony_ci int n_phy; 41162306a36Sopenharmony_ci spinlock_t lock; 41262306a36Sopenharmony_ci struct semaphore sem; 41362306a36Sopenharmony_ci 41462306a36Sopenharmony_ci struct timer_list timer; 41562306a36Sopenharmony_ci struct workqueue_struct *wq; 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_ci int slot_index_count; 41862306a36Sopenharmony_ci int last_slot_index; 41962306a36Sopenharmony_ci int last_dev_id; 42062306a36Sopenharmony_ci unsigned long *slot_index_tags; 42162306a36Sopenharmony_ci unsigned long reject_stp_links_msk; 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_ci /* SCSI/SAS glue */ 42462306a36Sopenharmony_ci struct sas_ha_struct sha; 42562306a36Sopenharmony_ci struct Scsi_Host *shost; 42662306a36Sopenharmony_ci 42762306a36Sopenharmony_ci struct hisi_sas_cq cq[HISI_SAS_MAX_QUEUES]; 42862306a36Sopenharmony_ci struct hisi_sas_dq dq[HISI_SAS_MAX_QUEUES]; 42962306a36Sopenharmony_ci struct hisi_sas_phy phy[HISI_SAS_MAX_PHYS]; 43062306a36Sopenharmony_ci struct hisi_sas_port port[HISI_SAS_MAX_PHYS]; 43162306a36Sopenharmony_ci 43262306a36Sopenharmony_ci int queue_count; 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci struct hisi_sas_device devices[HISI_SAS_MAX_DEVICES]; 43562306a36Sopenharmony_ci struct hisi_sas_cmd_hdr *cmd_hdr[HISI_SAS_MAX_QUEUES]; 43662306a36Sopenharmony_ci dma_addr_t cmd_hdr_dma[HISI_SAS_MAX_QUEUES]; 43762306a36Sopenharmony_ci void *complete_hdr[HISI_SAS_MAX_QUEUES]; 43862306a36Sopenharmony_ci dma_addr_t complete_hdr_dma[HISI_SAS_MAX_QUEUES]; 43962306a36Sopenharmony_ci struct hisi_sas_initial_fis *initial_fis; 44062306a36Sopenharmony_ci dma_addr_t initial_fis_dma; 44162306a36Sopenharmony_ci struct hisi_sas_itct *itct; 44262306a36Sopenharmony_ci dma_addr_t itct_dma; 44362306a36Sopenharmony_ci struct hisi_sas_iost *iost; 44462306a36Sopenharmony_ci dma_addr_t iost_dma; 44562306a36Sopenharmony_ci struct hisi_sas_breakpoint *breakpoint; 44662306a36Sopenharmony_ci dma_addr_t breakpoint_dma; 44762306a36Sopenharmony_ci struct hisi_sas_breakpoint *sata_breakpoint; 44862306a36Sopenharmony_ci dma_addr_t sata_breakpoint_dma; 44962306a36Sopenharmony_ci struct hisi_sas_slot *slot_info; 45062306a36Sopenharmony_ci unsigned long flags; 45162306a36Sopenharmony_ci const struct hisi_sas_hw *hw; /* Low level hw interface */ 45262306a36Sopenharmony_ci unsigned long sata_dev_bitmap[BITS_TO_LONGS(HISI_SAS_MAX_DEVICES)]; 45362306a36Sopenharmony_ci struct work_struct rst_work; 45462306a36Sopenharmony_ci struct work_struct debugfs_work; 45562306a36Sopenharmony_ci u32 phy_state; 45662306a36Sopenharmony_ci u32 intr_coal_ticks; /* Time of interrupt coalesce in us */ 45762306a36Sopenharmony_ci u32 intr_coal_count; /* Interrupt count to coalesce */ 45862306a36Sopenharmony_ci 45962306a36Sopenharmony_ci int cq_nvecs; 46062306a36Sopenharmony_ci 46162306a36Sopenharmony_ci /* bist */ 46262306a36Sopenharmony_ci enum sas_linkrate debugfs_bist_linkrate; 46362306a36Sopenharmony_ci int debugfs_bist_code_mode; 46462306a36Sopenharmony_ci int debugfs_bist_phy_no; 46562306a36Sopenharmony_ci int debugfs_bist_mode; 46662306a36Sopenharmony_ci u32 debugfs_bist_cnt; 46762306a36Sopenharmony_ci int debugfs_bist_enable; 46862306a36Sopenharmony_ci u32 debugfs_bist_ffe[HISI_SAS_MAX_PHYS][FFE_CFG_MAX]; 46962306a36Sopenharmony_ci u32 debugfs_bist_fixed_code[FIXED_CODE_MAX]; 47062306a36Sopenharmony_ci 47162306a36Sopenharmony_ci /* debugfs memories */ 47262306a36Sopenharmony_ci /* Put Global AXI and RAS Register into register array */ 47362306a36Sopenharmony_ci struct hisi_sas_debugfs_regs debugfs_regs[HISI_SAS_MAX_DEBUGFS_DUMP][DEBUGFS_REGS_NUM]; 47462306a36Sopenharmony_ci struct hisi_sas_debugfs_port debugfs_port_reg[HISI_SAS_MAX_DEBUGFS_DUMP][HISI_SAS_MAX_PHYS]; 47562306a36Sopenharmony_ci struct hisi_sas_debugfs_cq debugfs_cq[HISI_SAS_MAX_DEBUGFS_DUMP][HISI_SAS_MAX_QUEUES]; 47662306a36Sopenharmony_ci struct hisi_sas_debugfs_dq debugfs_dq[HISI_SAS_MAX_DEBUGFS_DUMP][HISI_SAS_MAX_QUEUES]; 47762306a36Sopenharmony_ci struct hisi_sas_debugfs_iost debugfs_iost[HISI_SAS_MAX_DEBUGFS_DUMP]; 47862306a36Sopenharmony_ci struct hisi_sas_debugfs_itct debugfs_itct[HISI_SAS_MAX_DEBUGFS_DUMP]; 47962306a36Sopenharmony_ci struct hisi_sas_debugfs_iost_cache debugfs_iost_cache[HISI_SAS_MAX_DEBUGFS_DUMP]; 48062306a36Sopenharmony_ci struct hisi_sas_debugfs_itct_cache debugfs_itct_cache[HISI_SAS_MAX_DEBUGFS_DUMP]; 48162306a36Sopenharmony_ci 48262306a36Sopenharmony_ci u64 debugfs_timestamp[HISI_SAS_MAX_DEBUGFS_DUMP]; 48362306a36Sopenharmony_ci int debugfs_dump_index; 48462306a36Sopenharmony_ci struct dentry *debugfs_dir; 48562306a36Sopenharmony_ci struct dentry *debugfs_dump_dentry; 48662306a36Sopenharmony_ci struct dentry *debugfs_bist_dentry; 48762306a36Sopenharmony_ci struct dentry *debugfs_fifo_dentry; 48862306a36Sopenharmony_ci 48962306a36Sopenharmony_ci int iopoll_q_cnt; 49062306a36Sopenharmony_ci}; 49162306a36Sopenharmony_ci 49262306a36Sopenharmony_ci/* Generic HW DMA host memory structures */ 49362306a36Sopenharmony_ci/* Delivery queue header */ 49462306a36Sopenharmony_cistruct hisi_sas_cmd_hdr { 49562306a36Sopenharmony_ci /* dw0 */ 49662306a36Sopenharmony_ci __le32 dw0; 49762306a36Sopenharmony_ci 49862306a36Sopenharmony_ci /* dw1 */ 49962306a36Sopenharmony_ci __le32 dw1; 50062306a36Sopenharmony_ci 50162306a36Sopenharmony_ci /* dw2 */ 50262306a36Sopenharmony_ci __le32 dw2; 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_ci /* dw3 */ 50562306a36Sopenharmony_ci __le32 transfer_tags; 50662306a36Sopenharmony_ci 50762306a36Sopenharmony_ci /* dw4 */ 50862306a36Sopenharmony_ci __le32 data_transfer_len; 50962306a36Sopenharmony_ci 51062306a36Sopenharmony_ci /* dw5 */ 51162306a36Sopenharmony_ci __le32 first_burst_num; 51262306a36Sopenharmony_ci 51362306a36Sopenharmony_ci /* dw6 */ 51462306a36Sopenharmony_ci __le32 sg_len; 51562306a36Sopenharmony_ci 51662306a36Sopenharmony_ci /* dw7 */ 51762306a36Sopenharmony_ci __le32 dw7; 51862306a36Sopenharmony_ci 51962306a36Sopenharmony_ci /* dw8-9 */ 52062306a36Sopenharmony_ci __le64 cmd_table_addr; 52162306a36Sopenharmony_ci 52262306a36Sopenharmony_ci /* dw10-11 */ 52362306a36Sopenharmony_ci __le64 sts_buffer_addr; 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci /* dw12-13 */ 52662306a36Sopenharmony_ci __le64 prd_table_addr; 52762306a36Sopenharmony_ci 52862306a36Sopenharmony_ci /* dw14-15 */ 52962306a36Sopenharmony_ci __le64 dif_prd_table_addr; 53062306a36Sopenharmony_ci}; 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_cistruct hisi_sas_itct { 53362306a36Sopenharmony_ci __le64 qw0; 53462306a36Sopenharmony_ci __le64 sas_addr; 53562306a36Sopenharmony_ci __le64 qw2; 53662306a36Sopenharmony_ci __le64 qw3; 53762306a36Sopenharmony_ci __le64 qw4_15[12]; 53862306a36Sopenharmony_ci}; 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_cistruct hisi_sas_iost { 54162306a36Sopenharmony_ci __le64 qw0; 54262306a36Sopenharmony_ci __le64 qw1; 54362306a36Sopenharmony_ci __le64 qw2; 54462306a36Sopenharmony_ci __le64 qw3; 54562306a36Sopenharmony_ci}; 54662306a36Sopenharmony_ci 54762306a36Sopenharmony_cistruct hisi_sas_err_record { 54862306a36Sopenharmony_ci u32 data[4]; 54962306a36Sopenharmony_ci}; 55062306a36Sopenharmony_ci 55162306a36Sopenharmony_cistruct hisi_sas_initial_fis { 55262306a36Sopenharmony_ci struct hisi_sas_err_record err_record; 55362306a36Sopenharmony_ci struct dev_to_host_fis fis; 55462306a36Sopenharmony_ci u32 rsvd[3]; 55562306a36Sopenharmony_ci}; 55662306a36Sopenharmony_ci 55762306a36Sopenharmony_cistruct hisi_sas_breakpoint { 55862306a36Sopenharmony_ci u8 data[128]; 55962306a36Sopenharmony_ci}; 56062306a36Sopenharmony_ci 56162306a36Sopenharmony_cistruct hisi_sas_sata_breakpoint { 56262306a36Sopenharmony_ci struct hisi_sas_breakpoint tag[32]; 56362306a36Sopenharmony_ci}; 56462306a36Sopenharmony_ci 56562306a36Sopenharmony_cistruct hisi_sas_sge { 56662306a36Sopenharmony_ci __le64 addr; 56762306a36Sopenharmony_ci __le32 page_ctrl_0; 56862306a36Sopenharmony_ci __le32 page_ctrl_1; 56962306a36Sopenharmony_ci __le32 data_len; 57062306a36Sopenharmony_ci __le32 data_off; 57162306a36Sopenharmony_ci}; 57262306a36Sopenharmony_ci 57362306a36Sopenharmony_cistruct hisi_sas_command_table_smp { 57462306a36Sopenharmony_ci u8 bytes[44]; 57562306a36Sopenharmony_ci}; 57662306a36Sopenharmony_ci 57762306a36Sopenharmony_cistruct hisi_sas_command_table_stp { 57862306a36Sopenharmony_ci struct host_to_dev_fis command_fis; 57962306a36Sopenharmony_ci u8 dummy[12]; 58062306a36Sopenharmony_ci u8 atapi_cdb[ATAPI_CDB_LEN]; 58162306a36Sopenharmony_ci}; 58262306a36Sopenharmony_ci 58362306a36Sopenharmony_ci#define HISI_SAS_SGE_PAGE_CNT (124) 58462306a36Sopenharmony_cistruct hisi_sas_sge_page { 58562306a36Sopenharmony_ci struct hisi_sas_sge sge[HISI_SAS_SGE_PAGE_CNT]; 58662306a36Sopenharmony_ci} __aligned(16); 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_ci#define HISI_SAS_SGE_DIF_PAGE_CNT HISI_SAS_SGE_PAGE_CNT 58962306a36Sopenharmony_cistruct hisi_sas_sge_dif_page { 59062306a36Sopenharmony_ci struct hisi_sas_sge sge[HISI_SAS_SGE_DIF_PAGE_CNT]; 59162306a36Sopenharmony_ci} __aligned(16); 59262306a36Sopenharmony_ci 59362306a36Sopenharmony_cistruct hisi_sas_command_table_ssp { 59462306a36Sopenharmony_ci struct ssp_frame_hdr hdr; 59562306a36Sopenharmony_ci union { 59662306a36Sopenharmony_ci struct { 59762306a36Sopenharmony_ci struct ssp_command_iu task; 59862306a36Sopenharmony_ci u32 prot[7]; 59962306a36Sopenharmony_ci }; 60062306a36Sopenharmony_ci struct ssp_tmf_iu ssp_task; 60162306a36Sopenharmony_ci struct xfer_rdy_iu xfer_rdy; 60262306a36Sopenharmony_ci struct ssp_response_iu ssp_res; 60362306a36Sopenharmony_ci } u; 60462306a36Sopenharmony_ci}; 60562306a36Sopenharmony_ci 60662306a36Sopenharmony_ciunion hisi_sas_command_table { 60762306a36Sopenharmony_ci struct hisi_sas_command_table_ssp ssp; 60862306a36Sopenharmony_ci struct hisi_sas_command_table_smp smp; 60962306a36Sopenharmony_ci struct hisi_sas_command_table_stp stp; 61062306a36Sopenharmony_ci} __aligned(16); 61162306a36Sopenharmony_ci 61262306a36Sopenharmony_cistruct hisi_sas_status_buffer { 61362306a36Sopenharmony_ci struct hisi_sas_err_record err; 61462306a36Sopenharmony_ci u8 iu[1024]; 61562306a36Sopenharmony_ci} __aligned(16); 61662306a36Sopenharmony_ci 61762306a36Sopenharmony_cistruct hisi_sas_slot_buf_table { 61862306a36Sopenharmony_ci struct hisi_sas_status_buffer status_buffer; 61962306a36Sopenharmony_ci union hisi_sas_command_table command_header; 62062306a36Sopenharmony_ci struct hisi_sas_sge_page sge_page; 62162306a36Sopenharmony_ci}; 62262306a36Sopenharmony_ci 62362306a36Sopenharmony_cistruct hisi_sas_slot_dif_buf_table { 62462306a36Sopenharmony_ci struct hisi_sas_slot_buf_table slot_buf; 62562306a36Sopenharmony_ci struct hisi_sas_sge_dif_page sge_dif_page; 62662306a36Sopenharmony_ci}; 62762306a36Sopenharmony_ci 62862306a36Sopenharmony_ciextern struct scsi_transport_template *hisi_sas_stt; 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_ciextern bool hisi_sas_debugfs_enable; 63162306a36Sopenharmony_ciextern u32 hisi_sas_debugfs_dump_count; 63262306a36Sopenharmony_ciextern struct dentry *hisi_sas_debugfs_dir; 63362306a36Sopenharmony_ci 63462306a36Sopenharmony_ciextern void hisi_sas_stop_phys(struct hisi_hba *hisi_hba); 63562306a36Sopenharmony_ciextern int hisi_sas_alloc(struct hisi_hba *hisi_hba); 63662306a36Sopenharmony_ciextern void hisi_sas_free(struct hisi_hba *hisi_hba); 63762306a36Sopenharmony_ciextern u8 hisi_sas_get_ata_protocol(struct host_to_dev_fis *fis, 63862306a36Sopenharmony_ci int direction); 63962306a36Sopenharmony_ciextern struct hisi_sas_port *to_hisi_sas_port(struct asd_sas_port *sas_port); 64062306a36Sopenharmony_ciextern void hisi_sas_sata_done(struct sas_task *task, 64162306a36Sopenharmony_ci struct hisi_sas_slot *slot); 64262306a36Sopenharmony_ciextern int hisi_sas_get_fw_info(struct hisi_hba *hisi_hba); 64362306a36Sopenharmony_ciextern int hisi_sas_probe(struct platform_device *pdev, 64462306a36Sopenharmony_ci const struct hisi_sas_hw *ops); 64562306a36Sopenharmony_ciextern void hisi_sas_remove(struct platform_device *pdev); 64662306a36Sopenharmony_ci 64762306a36Sopenharmony_ciextern int hisi_sas_slave_configure(struct scsi_device *sdev); 64862306a36Sopenharmony_ciextern int hisi_sas_slave_alloc(struct scsi_device *sdev); 64962306a36Sopenharmony_ciextern int hisi_sas_scan_finished(struct Scsi_Host *shost, unsigned long time); 65062306a36Sopenharmony_ciextern void hisi_sas_scan_start(struct Scsi_Host *shost); 65162306a36Sopenharmony_ciextern int hisi_sas_host_reset(struct Scsi_Host *shost, int reset_type); 65262306a36Sopenharmony_ciextern void hisi_sas_phy_enable(struct hisi_hba *hisi_hba, int phy_no, 65362306a36Sopenharmony_ci int enable); 65462306a36Sopenharmony_ciextern void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy, 65562306a36Sopenharmony_ci gfp_t gfp_flags); 65662306a36Sopenharmony_ciextern void hisi_sas_phy_bcast(struct hisi_sas_phy *phy); 65762306a36Sopenharmony_ciextern void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, 65862306a36Sopenharmony_ci struct sas_task *task, 65962306a36Sopenharmony_ci struct hisi_sas_slot *slot, 66062306a36Sopenharmony_ci bool need_lock); 66162306a36Sopenharmony_ciextern void hisi_sas_init_mem(struct hisi_hba *hisi_hba); 66262306a36Sopenharmony_ciextern void hisi_sas_rst_work_handler(struct work_struct *work); 66362306a36Sopenharmony_ciextern void hisi_sas_sync_rst_work_handler(struct work_struct *work); 66462306a36Sopenharmony_ciextern void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no); 66562306a36Sopenharmony_ciextern bool hisi_sas_notify_phy_event(struct hisi_sas_phy *phy, 66662306a36Sopenharmony_ci enum hisi_sas_phy_event event); 66762306a36Sopenharmony_ciextern void hisi_sas_release_tasks(struct hisi_hba *hisi_hba); 66862306a36Sopenharmony_ciextern u8 hisi_sas_get_prog_phy_linkrate_mask(enum sas_linkrate max); 66962306a36Sopenharmony_ciextern void hisi_sas_sync_cqs(struct hisi_hba *hisi_hba); 67062306a36Sopenharmony_ciextern void hisi_sas_sync_poll_cqs(struct hisi_hba *hisi_hba); 67162306a36Sopenharmony_ciextern void hisi_sas_controller_reset_prepare(struct hisi_hba *hisi_hba); 67262306a36Sopenharmony_ciextern void hisi_sas_controller_reset_done(struct hisi_hba *hisi_hba); 67362306a36Sopenharmony_ci#endif 674