1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2021 Broadcom. All Rights Reserved. The term 4 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 5 */ 6 7 #if !defined(__EFCT_DRIVER_H__) 8 #define __EFCT_DRIVER_H__ 9 10 /*************************************************************************** 11 * OS specific includes 12 */ 13 #include <linux/module.h> 14 #include <linux/debugfs.h> 15 #include <linux/firmware.h> 16 #include "../include/efc_common.h" 17 #include "../libefc/efclib.h" 18 #include "efct_hw.h" 19 #include "efct_io.h" 20 #include "efct_xport.h" 21 22 #define EFCT_DRIVER_NAME "efct" 23 #define EFCT_DRIVER_VERSION "1.0.0.0" 24 25 /* EFCT_DEFAULT_FILTER- 26 * MRQ filter to segregate the IO flow. 27 */ 28 #define EFCT_DEFAULT_FILTER "0x01ff22ff,0,0,0" 29 30 /* EFCT_OS_MAX_ISR_TIME_MSEC - 31 * maximum time driver code should spend in an interrupt 32 * or kernel thread context without yielding 33 */ 34 #define EFCT_OS_MAX_ISR_TIME_MSEC 1000 35 36 #define EFCT_FC_MAX_SGL 64 37 #define EFCT_FC_DIF_SEED 0 38 39 /* Watermark */ 40 #define EFCT_WATERMARK_HIGH_PCT 90 41 #define EFCT_WATERMARK_LOW_PCT 80 42 #define EFCT_IO_WATERMARK_PER_INITIATOR 8 43 44 #define EFCT_PCI_MAX_REGS 6 45 #define MAX_PCI_INTERRUPTS 16 46 47 struct efct_intr_context { 48 struct efct *efct; 49 u32 index; 50 }; 51 52 struct efct { 53 struct pci_dev *pci; 54 void __iomem *reg[EFCT_PCI_MAX_REGS]; 55 56 u32 n_msix_vec; 57 bool attached; 58 bool soft_wwn_enable; 59 u8 efct_req_fw_upgrade; 60 struct efct_intr_context intr_context[MAX_PCI_INTERRUPTS]; 61 u32 numa_node; 62 63 char name[EFC_NAME_LENGTH]; 64 u32 instance_index; 65 struct list_head list_entry; 66 struct efct_scsi_tgt tgt_efct; 67 struct efct_xport *xport; 68 struct efc *efcport; 69 struct Scsi_Host *shost; 70 int logmask; 71 u32 max_isr_time_msec; 72 73 const char *desc; 74 75 const char *model; 76 77 struct efct_hw hw; 78 79 u32 rq_selection_policy; 80 char *filter_def; 81 int topology; 82 83 /* Look up for target node */ 84 struct xarray lookup; 85 86 /* 87 * Target IO timer value: 88 * Zero: target command timeout disabled. 89 * Non-zero: Timeout value, in seconds, for target commands 90 */ 91 u32 target_io_timer_sec; 92 93 int speed; 94 struct dentry *sess_debugfs_dir; 95 }; 96 97 #define FW_WRITE_BUFSIZE (64 * 1024) 98 99 struct efct_fw_write_result { 100 struct completion done; 101 int status; 102 u32 actual_xfer; 103 u32 change_status; 104 }; 105 106 extern struct list_head efct_devices; 107 108 #endif /* __EFCT_DRIVER_H__ */ 109