efct_driver.h 2.3 KB

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