162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2021 Broadcom. All Rights Reserved. The term 462306a36Sopenharmony_ci * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef _EFCT_HW_H 862306a36Sopenharmony_ci#define _EFCT_HW_H 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#include "../libefc_sli/sli4.h" 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci/* 1362306a36Sopenharmony_ci * EFCT PCI IDs 1462306a36Sopenharmony_ci */ 1562306a36Sopenharmony_ci#define EFCT_VENDOR_ID 0x10df 1662306a36Sopenharmony_ci/* LightPulse 16Gb x 4 FC (lancer-g6) */ 1762306a36Sopenharmony_ci#define EFCT_DEVICE_LANCER_G6 0xe307 1862306a36Sopenharmony_ci/* LightPulse 32Gb x 4 FC (lancer-g7) */ 1962306a36Sopenharmony_ci#define EFCT_DEVICE_LANCER_G7 0xf407 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci/*Default RQ entries len used by driver*/ 2262306a36Sopenharmony_ci#define EFCT_HW_RQ_ENTRIES_MIN 512 2362306a36Sopenharmony_ci#define EFCT_HW_RQ_ENTRIES_DEF 1024 2462306a36Sopenharmony_ci#define EFCT_HW_RQ_ENTRIES_MAX 4096 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/*Defines the size of the RQ buffers used for each RQ*/ 2762306a36Sopenharmony_ci#define EFCT_HW_RQ_SIZE_HDR 128 2862306a36Sopenharmony_ci#define EFCT_HW_RQ_SIZE_PAYLOAD 1024 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci/*Define the maximum number of multi-receive queues*/ 3162306a36Sopenharmony_ci#define EFCT_HW_MAX_MRQS 8 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci/* 3462306a36Sopenharmony_ci * Define count of when to set the WQEC bit in a submitted 3562306a36Sopenharmony_ci * WQE, causing a consummed/released completion to be posted. 3662306a36Sopenharmony_ci */ 3762306a36Sopenharmony_ci#define EFCT_HW_WQEC_SET_COUNT 32 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/*Send frame timeout in seconds*/ 4062306a36Sopenharmony_ci#define EFCT_HW_SEND_FRAME_TIMEOUT 10 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci/* 4362306a36Sopenharmony_ci * FDT Transfer Hint value, reads greater than this value 4462306a36Sopenharmony_ci * will be segmented to implement fairness. A value of zero disables 4562306a36Sopenharmony_ci * the feature. 4662306a36Sopenharmony_ci */ 4762306a36Sopenharmony_ci#define EFCT_HW_FDT_XFER_HINT 8192 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci#define EFCT_HW_TIMECHECK_ITERATIONS 100 5062306a36Sopenharmony_ci#define EFCT_HW_MAX_NUM_MQ 1 5162306a36Sopenharmony_ci#define EFCT_HW_MAX_NUM_RQ 32 5262306a36Sopenharmony_ci#define EFCT_HW_MAX_NUM_EQ 16 5362306a36Sopenharmony_ci#define EFCT_HW_MAX_NUM_WQ 32 5462306a36Sopenharmony_ci#define EFCT_HW_DEF_NUM_EQ 1 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci#define OCE_HW_MAX_NUM_MRQ_PAIRS 16 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci#define EFCT_HW_MQ_DEPTH 128 5962306a36Sopenharmony_ci#define EFCT_HW_EQ_DEPTH 1024 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* 6262306a36Sopenharmony_ci * A CQ will be assinged to each WQ 6362306a36Sopenharmony_ci * (CQ must have 2X entries of the WQ for abort 6462306a36Sopenharmony_ci * processing), plus a separate one for each RQ PAIR and one for MQ 6562306a36Sopenharmony_ci */ 6662306a36Sopenharmony_ci#define EFCT_HW_MAX_NUM_CQ \ 6762306a36Sopenharmony_ci ((EFCT_HW_MAX_NUM_WQ * 2) + 1 + (OCE_HW_MAX_NUM_MRQ_PAIRS * 2)) 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci#define EFCT_HW_Q_HASH_SIZE 128 7062306a36Sopenharmony_ci#define EFCT_HW_RQ_HEADER_SIZE 128 7162306a36Sopenharmony_ci#define EFCT_HW_RQ_HEADER_INDEX 0 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define EFCT_HW_REQUE_XRI_REGTAG 65534 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci/* Options for efct_hw_command() */ 7662306a36Sopenharmony_cienum efct_cmd_opts { 7762306a36Sopenharmony_ci /* command executes synchronously and busy-waits for completion */ 7862306a36Sopenharmony_ci EFCT_CMD_POLL, 7962306a36Sopenharmony_ci /* command executes asynchronously. Uses callback */ 8062306a36Sopenharmony_ci EFCT_CMD_NOWAIT, 8162306a36Sopenharmony_ci}; 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_cienum efct_hw_reset { 8462306a36Sopenharmony_ci EFCT_HW_RESET_FUNCTION, 8562306a36Sopenharmony_ci EFCT_HW_RESET_FIRMWARE, 8662306a36Sopenharmony_ci EFCT_HW_RESET_MAX 8762306a36Sopenharmony_ci}; 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_cienum efct_hw_topo { 9062306a36Sopenharmony_ci EFCT_HW_TOPOLOGY_AUTO, 9162306a36Sopenharmony_ci EFCT_HW_TOPOLOGY_NPORT, 9262306a36Sopenharmony_ci EFCT_HW_TOPOLOGY_LOOP, 9362306a36Sopenharmony_ci EFCT_HW_TOPOLOGY_NONE, 9462306a36Sopenharmony_ci EFCT_HW_TOPOLOGY_MAX 9562306a36Sopenharmony_ci}; 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci/* pack fw revision values into a single uint64_t */ 9862306a36Sopenharmony_ci#define HW_FWREV(a, b, c, d) (((uint64_t)(a) << 48) | ((uint64_t)(b) << 32) \ 9962306a36Sopenharmony_ci | ((uint64_t)(c) << 16) | ((uint64_t)(d))) 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci#define EFCT_FW_VER_STR(a, b, c, d) (#a "." #b "." #c "." #d) 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_cienum efct_hw_io_type { 10462306a36Sopenharmony_ci EFCT_HW_ELS_REQ, 10562306a36Sopenharmony_ci EFCT_HW_ELS_RSP, 10662306a36Sopenharmony_ci EFCT_HW_FC_CT, 10762306a36Sopenharmony_ci EFCT_HW_FC_CT_RSP, 10862306a36Sopenharmony_ci EFCT_HW_BLS_ACC, 10962306a36Sopenharmony_ci EFCT_HW_BLS_RJT, 11062306a36Sopenharmony_ci EFCT_HW_IO_TARGET_READ, 11162306a36Sopenharmony_ci EFCT_HW_IO_TARGET_WRITE, 11262306a36Sopenharmony_ci EFCT_HW_IO_TARGET_RSP, 11362306a36Sopenharmony_ci EFCT_HW_IO_DNRX_REQUEUE, 11462306a36Sopenharmony_ci EFCT_HW_IO_MAX, 11562306a36Sopenharmony_ci}; 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_cienum efct_hw_io_state { 11862306a36Sopenharmony_ci EFCT_HW_IO_STATE_FREE, 11962306a36Sopenharmony_ci EFCT_HW_IO_STATE_INUSE, 12062306a36Sopenharmony_ci EFCT_HW_IO_STATE_WAIT_FREE, 12162306a36Sopenharmony_ci EFCT_HW_IO_STATE_WAIT_SEC_HIO, 12262306a36Sopenharmony_ci}; 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci#define EFCT_TARGET_WRITE_SKIPS 1 12562306a36Sopenharmony_ci#define EFCT_TARGET_READ_SKIPS 2 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_cistruct efct_hw; 12862306a36Sopenharmony_cistruct efct_io; 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci#define EFCT_CMD_CTX_POOL_SZ 32 13162306a36Sopenharmony_ci/** 13262306a36Sopenharmony_ci * HW command context. 13362306a36Sopenharmony_ci * Stores the state for the asynchronous commands sent to the hardware. 13462306a36Sopenharmony_ci */ 13562306a36Sopenharmony_cistruct efct_command_ctx { 13662306a36Sopenharmony_ci struct list_head list_entry; 13762306a36Sopenharmony_ci int (*cb)(struct efct_hw *hw, int status, u8 *mqe, void *arg); 13862306a36Sopenharmony_ci void *arg; /* Argument for callback */ 13962306a36Sopenharmony_ci /* buffer holding command / results */ 14062306a36Sopenharmony_ci u8 buf[SLI4_BMBX_SIZE]; 14162306a36Sopenharmony_ci void *ctx; /* upper layer context */ 14262306a36Sopenharmony_ci}; 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_cistruct efct_hw_sgl { 14562306a36Sopenharmony_ci uintptr_t addr; 14662306a36Sopenharmony_ci size_t len; 14762306a36Sopenharmony_ci}; 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ciunion efct_hw_io_param_u { 15062306a36Sopenharmony_ci struct sli_bls_params bls; 15162306a36Sopenharmony_ci struct sli_els_params els; 15262306a36Sopenharmony_ci struct sli_ct_params fc_ct; 15362306a36Sopenharmony_ci struct sli_fcp_tgt_params fcp_tgt; 15462306a36Sopenharmony_ci}; 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci/* WQ steering mode */ 15762306a36Sopenharmony_cienum efct_hw_wq_steering { 15862306a36Sopenharmony_ci EFCT_HW_WQ_STEERING_CLASS, 15962306a36Sopenharmony_ci EFCT_HW_WQ_STEERING_REQUEST, 16062306a36Sopenharmony_ci EFCT_HW_WQ_STEERING_CPU, 16162306a36Sopenharmony_ci}; 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci/* HW wqe object */ 16462306a36Sopenharmony_cistruct efct_hw_wqe { 16562306a36Sopenharmony_ci struct list_head list_entry; 16662306a36Sopenharmony_ci bool abort_wqe_submit_needed; 16762306a36Sopenharmony_ci bool send_abts; 16862306a36Sopenharmony_ci u32 id; 16962306a36Sopenharmony_ci u32 abort_reqtag; 17062306a36Sopenharmony_ci u8 *wqebuf; 17162306a36Sopenharmony_ci}; 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_cistruct efct_hw_io; 17462306a36Sopenharmony_ci/* Typedef for HW "done" callback */ 17562306a36Sopenharmony_citypedef int (*efct_hw_done_t)(struct efct_hw_io *, u32 len, int status, 17662306a36Sopenharmony_ci u32 ext, void *ul_arg); 17762306a36Sopenharmony_ci 17862306a36Sopenharmony_ci/** 17962306a36Sopenharmony_ci * HW IO object. 18062306a36Sopenharmony_ci * 18162306a36Sopenharmony_ci * Stores the per-IO information necessary 18262306a36Sopenharmony_ci * for both SLI and efct. 18362306a36Sopenharmony_ci * @ref: reference counter for hw io object 18462306a36Sopenharmony_ci * @state: state of IO: free, busy, wait_free 18562306a36Sopenharmony_ci * @list_entry used for busy, wait_free, free lists 18662306a36Sopenharmony_ci * @wqe Work queue object, with link for pending 18762306a36Sopenharmony_ci * @hw pointer back to hardware context 18862306a36Sopenharmony_ci * @xfer_rdy transfer ready data 18962306a36Sopenharmony_ci * @type IO type 19062306a36Sopenharmony_ci * @xbusy Exchange is active in FW 19162306a36Sopenharmony_ci * @abort_in_progress if TRUE, abort is in progress 19262306a36Sopenharmony_ci * @status_saved if TRUE, latched status should be returned 19362306a36Sopenharmony_ci * @wq_class WQ class if steering mode is Class 19462306a36Sopenharmony_ci * @reqtag request tag for this HW IO 19562306a36Sopenharmony_ci * @wq WQ assigned to the exchange 19662306a36Sopenharmony_ci * @done Function called on IO completion 19762306a36Sopenharmony_ci * @arg argument passed to IO done callback 19862306a36Sopenharmony_ci * @abort_done Function called on abort completion 19962306a36Sopenharmony_ci * @abort_arg argument passed to abort done callback 20062306a36Sopenharmony_ci * @wq_steering WQ steering mode request 20162306a36Sopenharmony_ci * @saved_status Saved status 20262306a36Sopenharmony_ci * @saved_len Status length 20362306a36Sopenharmony_ci * @saved_ext Saved extended status 20462306a36Sopenharmony_ci * @eq EQ on which this HIO came up 20562306a36Sopenharmony_ci * @sge_offset SGE data offset 20662306a36Sopenharmony_ci * @def_sgl_count Count of SGEs in default SGL 20762306a36Sopenharmony_ci * @abort_reqtag request tag for an abort of this HW IO 20862306a36Sopenharmony_ci * @indicator Exchange indicator 20962306a36Sopenharmony_ci * @def_sgl default SGL 21062306a36Sopenharmony_ci * @sgl pointer to current active SGL 21162306a36Sopenharmony_ci * @sgl_count count of SGEs in io->sgl 21262306a36Sopenharmony_ci * @first_data_sge index of first data SGE 21362306a36Sopenharmony_ci * @n_sge number of active SGEs 21462306a36Sopenharmony_ci */ 21562306a36Sopenharmony_cistruct efct_hw_io { 21662306a36Sopenharmony_ci struct kref ref; 21762306a36Sopenharmony_ci enum efct_hw_io_state state; 21862306a36Sopenharmony_ci void (*release)(struct kref *arg); 21962306a36Sopenharmony_ci struct list_head list_entry; 22062306a36Sopenharmony_ci struct efct_hw_wqe wqe; 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ci struct efct_hw *hw; 22362306a36Sopenharmony_ci struct efc_dma xfer_rdy; 22462306a36Sopenharmony_ci u16 type; 22562306a36Sopenharmony_ci bool xbusy; 22662306a36Sopenharmony_ci int abort_in_progress; 22762306a36Sopenharmony_ci bool status_saved; 22862306a36Sopenharmony_ci u8 wq_class; 22962306a36Sopenharmony_ci u16 reqtag; 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci struct hw_wq *wq; 23262306a36Sopenharmony_ci efct_hw_done_t done; 23362306a36Sopenharmony_ci void *arg; 23462306a36Sopenharmony_ci efct_hw_done_t abort_done; 23562306a36Sopenharmony_ci void *abort_arg; 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ci enum efct_hw_wq_steering wq_steering; 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci u32 saved_status; 24062306a36Sopenharmony_ci u32 saved_len; 24162306a36Sopenharmony_ci u32 saved_ext; 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci struct hw_eq *eq; 24462306a36Sopenharmony_ci u32 sge_offset; 24562306a36Sopenharmony_ci u32 def_sgl_count; 24662306a36Sopenharmony_ci u32 abort_reqtag; 24762306a36Sopenharmony_ci u32 indicator; 24862306a36Sopenharmony_ci struct efc_dma def_sgl; 24962306a36Sopenharmony_ci struct efc_dma *sgl; 25062306a36Sopenharmony_ci u32 sgl_count; 25162306a36Sopenharmony_ci u32 first_data_sge; 25262306a36Sopenharmony_ci u32 n_sge; 25362306a36Sopenharmony_ci}; 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_cienum efct_hw_port { 25662306a36Sopenharmony_ci EFCT_HW_PORT_INIT, 25762306a36Sopenharmony_ci EFCT_HW_PORT_SHUTDOWN, 25862306a36Sopenharmony_ci}; 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_ci/* Node group rpi reference */ 26162306a36Sopenharmony_cistruct efct_hw_rpi_ref { 26262306a36Sopenharmony_ci atomic_t rpi_count; 26362306a36Sopenharmony_ci atomic_t rpi_attached; 26462306a36Sopenharmony_ci}; 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_cienum efct_hw_link_stat { 26762306a36Sopenharmony_ci EFCT_HW_LINK_STAT_LINK_FAILURE_COUNT, 26862306a36Sopenharmony_ci EFCT_HW_LINK_STAT_LOSS_OF_SYNC_COUNT, 26962306a36Sopenharmony_ci EFCT_HW_LINK_STAT_LOSS_OF_SIGNAL_COUNT, 27062306a36Sopenharmony_ci EFCT_HW_LINK_STAT_PRIMITIVE_SEQ_COUNT, 27162306a36Sopenharmony_ci EFCT_HW_LINK_STAT_INVALID_XMIT_WORD_COUNT, 27262306a36Sopenharmony_ci EFCT_HW_LINK_STAT_CRC_COUNT, 27362306a36Sopenharmony_ci EFCT_HW_LINK_STAT_PRIMITIVE_SEQ_TIMEOUT_COUNT, 27462306a36Sopenharmony_ci EFCT_HW_LINK_STAT_ELASTIC_BUFFER_OVERRUN_COUNT, 27562306a36Sopenharmony_ci EFCT_HW_LINK_STAT_ARB_TIMEOUT_COUNT, 27662306a36Sopenharmony_ci EFCT_HW_LINK_STAT_ADVERTISED_RCV_B2B_CREDIT, 27762306a36Sopenharmony_ci EFCT_HW_LINK_STAT_CURR_RCV_B2B_CREDIT, 27862306a36Sopenharmony_ci EFCT_HW_LINK_STAT_ADVERTISED_XMIT_B2B_CREDIT, 27962306a36Sopenharmony_ci EFCT_HW_LINK_STAT_CURR_XMIT_B2B_CREDIT, 28062306a36Sopenharmony_ci EFCT_HW_LINK_STAT_RCV_EOFA_COUNT, 28162306a36Sopenharmony_ci EFCT_HW_LINK_STAT_RCV_EOFDTI_COUNT, 28262306a36Sopenharmony_ci EFCT_HW_LINK_STAT_RCV_EOFNI_COUNT, 28362306a36Sopenharmony_ci EFCT_HW_LINK_STAT_RCV_SOFF_COUNT, 28462306a36Sopenharmony_ci EFCT_HW_LINK_STAT_RCV_DROPPED_NO_AER_COUNT, 28562306a36Sopenharmony_ci EFCT_HW_LINK_STAT_RCV_DROPPED_NO_RPI_COUNT, 28662306a36Sopenharmony_ci EFCT_HW_LINK_STAT_RCV_DROPPED_NO_XRI_COUNT, 28762306a36Sopenharmony_ci EFCT_HW_LINK_STAT_MAX, 28862306a36Sopenharmony_ci}; 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_cienum efct_hw_host_stat { 29162306a36Sopenharmony_ci EFCT_HW_HOST_STAT_TX_KBYTE_COUNT, 29262306a36Sopenharmony_ci EFCT_HW_HOST_STAT_RX_KBYTE_COUNT, 29362306a36Sopenharmony_ci EFCT_HW_HOST_STAT_TX_FRAME_COUNT, 29462306a36Sopenharmony_ci EFCT_HW_HOST_STAT_RX_FRAME_COUNT, 29562306a36Sopenharmony_ci EFCT_HW_HOST_STAT_TX_SEQ_COUNT, 29662306a36Sopenharmony_ci EFCT_HW_HOST_STAT_RX_SEQ_COUNT, 29762306a36Sopenharmony_ci EFCT_HW_HOST_STAT_TOTAL_EXCH_ORIG, 29862306a36Sopenharmony_ci EFCT_HW_HOST_STAT_TOTAL_EXCH_RESP, 29962306a36Sopenharmony_ci EFCT_HW_HOSY_STAT_RX_P_BSY_COUNT, 30062306a36Sopenharmony_ci EFCT_HW_HOST_STAT_RX_F_BSY_COUNT, 30162306a36Sopenharmony_ci EFCT_HW_HOST_STAT_DROP_FRM_DUE_TO_NO_RQ_BUF_COUNT, 30262306a36Sopenharmony_ci EFCT_HW_HOST_STAT_EMPTY_RQ_TIMEOUT_COUNT, 30362306a36Sopenharmony_ci EFCT_HW_HOST_STAT_DROP_FRM_DUE_TO_NO_XRI_COUNT, 30462306a36Sopenharmony_ci EFCT_HW_HOST_STAT_EMPTY_XRI_POOL_COUNT, 30562306a36Sopenharmony_ci EFCT_HW_HOST_STAT_MAX, 30662306a36Sopenharmony_ci}; 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_cienum efct_hw_state { 30962306a36Sopenharmony_ci EFCT_HW_STATE_UNINITIALIZED, 31062306a36Sopenharmony_ci EFCT_HW_STATE_QUEUES_ALLOCATED, 31162306a36Sopenharmony_ci EFCT_HW_STATE_ACTIVE, 31262306a36Sopenharmony_ci EFCT_HW_STATE_RESET_IN_PROGRESS, 31362306a36Sopenharmony_ci EFCT_HW_STATE_TEARDOWN_IN_PROGRESS, 31462306a36Sopenharmony_ci}; 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_cistruct efct_hw_link_stat_counts { 31762306a36Sopenharmony_ci u8 overflow; 31862306a36Sopenharmony_ci u32 counter; 31962306a36Sopenharmony_ci}; 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_cistruct efct_hw_host_stat_counts { 32262306a36Sopenharmony_ci u32 counter; 32362306a36Sopenharmony_ci}; 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_ci/* Structure used for the hash lookup of queue IDs */ 32662306a36Sopenharmony_cistruct efct_queue_hash { 32762306a36Sopenharmony_ci bool in_use; 32862306a36Sopenharmony_ci u16 id; 32962306a36Sopenharmony_ci u16 index; 33062306a36Sopenharmony_ci}; 33162306a36Sopenharmony_ci 33262306a36Sopenharmony_ci/* WQ callback object */ 33362306a36Sopenharmony_cistruct hw_wq_callback { 33462306a36Sopenharmony_ci u16 instance_index; /* use for request tag */ 33562306a36Sopenharmony_ci void (*callback)(void *arg, u8 *cqe, int status); 33662306a36Sopenharmony_ci void *arg; 33762306a36Sopenharmony_ci struct list_head list_entry; 33862306a36Sopenharmony_ci}; 33962306a36Sopenharmony_ci 34062306a36Sopenharmony_cistruct reqtag_pool { 34162306a36Sopenharmony_ci spinlock_t lock; /* pool lock */ 34262306a36Sopenharmony_ci struct hw_wq_callback *tags[U16_MAX]; 34362306a36Sopenharmony_ci struct list_head freelist; 34462306a36Sopenharmony_ci}; 34562306a36Sopenharmony_ci 34662306a36Sopenharmony_cistruct efct_hw_config { 34762306a36Sopenharmony_ci u32 n_eq; 34862306a36Sopenharmony_ci u32 n_cq; 34962306a36Sopenharmony_ci u32 n_mq; 35062306a36Sopenharmony_ci u32 n_rq; 35162306a36Sopenharmony_ci u32 n_wq; 35262306a36Sopenharmony_ci u32 n_io; 35362306a36Sopenharmony_ci u32 n_sgl; 35462306a36Sopenharmony_ci u32 speed; 35562306a36Sopenharmony_ci u32 topology; 35662306a36Sopenharmony_ci /* size of the buffers for first burst */ 35762306a36Sopenharmony_ci u32 rq_default_buffer_size; 35862306a36Sopenharmony_ci u8 esoc; 35962306a36Sopenharmony_ci /* MRQ RQ selection policy */ 36062306a36Sopenharmony_ci u8 rq_selection_policy; 36162306a36Sopenharmony_ci /* RQ quanta if rq_selection_policy == 2 */ 36262306a36Sopenharmony_ci u8 rr_quanta; 36362306a36Sopenharmony_ci u32 filter_def[SLI4_CMD_REG_FCFI_NUM_RQ_CFG]; 36462306a36Sopenharmony_ci}; 36562306a36Sopenharmony_ci 36662306a36Sopenharmony_cistruct efct_hw { 36762306a36Sopenharmony_ci struct efct *os; 36862306a36Sopenharmony_ci struct sli4 sli; 36962306a36Sopenharmony_ci u16 ulp_start; 37062306a36Sopenharmony_ci u16 ulp_max; 37162306a36Sopenharmony_ci u32 dump_size; 37262306a36Sopenharmony_ci enum efct_hw_state state; 37362306a36Sopenharmony_ci bool hw_setup_called; 37462306a36Sopenharmony_ci u8 sliport_healthcheck; 37562306a36Sopenharmony_ci u16 fcf_indicator; 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_ci /* HW configuration */ 37862306a36Sopenharmony_ci struct efct_hw_config config; 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ci /* calculated queue sizes for each type */ 38162306a36Sopenharmony_ci u32 num_qentries[SLI4_QTYPE_MAX]; 38262306a36Sopenharmony_ci 38362306a36Sopenharmony_ci /* Storage for SLI queue objects */ 38462306a36Sopenharmony_ci struct sli4_queue wq[EFCT_HW_MAX_NUM_WQ]; 38562306a36Sopenharmony_ci struct sli4_queue rq[EFCT_HW_MAX_NUM_RQ]; 38662306a36Sopenharmony_ci u16 hw_rq_lookup[EFCT_HW_MAX_NUM_RQ]; 38762306a36Sopenharmony_ci struct sli4_queue mq[EFCT_HW_MAX_NUM_MQ]; 38862306a36Sopenharmony_ci struct sli4_queue cq[EFCT_HW_MAX_NUM_CQ]; 38962306a36Sopenharmony_ci struct sli4_queue eq[EFCT_HW_MAX_NUM_EQ]; 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_ci /* HW queue */ 39262306a36Sopenharmony_ci u32 eq_count; 39362306a36Sopenharmony_ci u32 cq_count; 39462306a36Sopenharmony_ci u32 mq_count; 39562306a36Sopenharmony_ci u32 wq_count; 39662306a36Sopenharmony_ci u32 rq_count; 39762306a36Sopenharmony_ci u32 cmd_head_count; 39862306a36Sopenharmony_ci struct list_head eq_list; 39962306a36Sopenharmony_ci 40062306a36Sopenharmony_ci struct efct_queue_hash cq_hash[EFCT_HW_Q_HASH_SIZE]; 40162306a36Sopenharmony_ci struct efct_queue_hash rq_hash[EFCT_HW_Q_HASH_SIZE]; 40262306a36Sopenharmony_ci struct efct_queue_hash wq_hash[EFCT_HW_Q_HASH_SIZE]; 40362306a36Sopenharmony_ci 40462306a36Sopenharmony_ci /* Storage for HW queue objects */ 40562306a36Sopenharmony_ci struct hw_wq *hw_wq[EFCT_HW_MAX_NUM_WQ]; 40662306a36Sopenharmony_ci struct hw_rq *hw_rq[EFCT_HW_MAX_NUM_RQ]; 40762306a36Sopenharmony_ci struct hw_mq *hw_mq[EFCT_HW_MAX_NUM_MQ]; 40862306a36Sopenharmony_ci struct hw_cq *hw_cq[EFCT_HW_MAX_NUM_CQ]; 40962306a36Sopenharmony_ci struct hw_eq *hw_eq[EFCT_HW_MAX_NUM_EQ]; 41062306a36Sopenharmony_ci /* count of hw_rq[] entries */ 41162306a36Sopenharmony_ci u32 hw_rq_count; 41262306a36Sopenharmony_ci /* count of multirq RQs */ 41362306a36Sopenharmony_ci u32 hw_mrq_count; 41462306a36Sopenharmony_ci 41562306a36Sopenharmony_ci struct hw_wq **wq_cpu_array; 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_ci /* Sequence objects used in incoming frame processing */ 41862306a36Sopenharmony_ci struct efc_hw_sequence *seq_pool; 41962306a36Sopenharmony_ci 42062306a36Sopenharmony_ci /* Maintain an ordered, linked list of outstanding HW commands. */ 42162306a36Sopenharmony_ci struct mutex bmbx_lock; 42262306a36Sopenharmony_ci spinlock_t cmd_lock; 42362306a36Sopenharmony_ci struct list_head cmd_head; 42462306a36Sopenharmony_ci struct list_head cmd_pending; 42562306a36Sopenharmony_ci mempool_t *cmd_ctx_pool; 42662306a36Sopenharmony_ci mempool_t *mbox_rqst_pool; 42762306a36Sopenharmony_ci 42862306a36Sopenharmony_ci struct sli4_link_event link; 42962306a36Sopenharmony_ci 43062306a36Sopenharmony_ci /* pointer array of IO objects */ 43162306a36Sopenharmony_ci struct efct_hw_io **io; 43262306a36Sopenharmony_ci /* array of WQE buffs mapped to IO objects */ 43362306a36Sopenharmony_ci u8 *wqe_buffs; 43462306a36Sopenharmony_ci 43562306a36Sopenharmony_ci /* IO lock to synchronize list access */ 43662306a36Sopenharmony_ci spinlock_t io_lock; 43762306a36Sopenharmony_ci /* List of IO objects in use */ 43862306a36Sopenharmony_ci struct list_head io_inuse; 43962306a36Sopenharmony_ci /* List of IO objects waiting to be freed */ 44062306a36Sopenharmony_ci struct list_head io_wait_free; 44162306a36Sopenharmony_ci /* List of IO objects available for allocation */ 44262306a36Sopenharmony_ci struct list_head io_free; 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci struct efc_dma loop_map; 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_ci struct efc_dma xfer_rdy; 44762306a36Sopenharmony_ci 44862306a36Sopenharmony_ci struct efc_dma rnode_mem; 44962306a36Sopenharmony_ci 45062306a36Sopenharmony_ci atomic_t io_alloc_failed_count; 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_ci /* stat: wq sumbit count */ 45362306a36Sopenharmony_ci u32 tcmd_wq_submit[EFCT_HW_MAX_NUM_WQ]; 45462306a36Sopenharmony_ci /* stat: wq complete count */ 45562306a36Sopenharmony_ci u32 tcmd_wq_complete[EFCT_HW_MAX_NUM_WQ]; 45662306a36Sopenharmony_ci 45762306a36Sopenharmony_ci atomic_t send_frame_seq_id; 45862306a36Sopenharmony_ci struct reqtag_pool *wq_reqtag_pool; 45962306a36Sopenharmony_ci}; 46062306a36Sopenharmony_ci 46162306a36Sopenharmony_cienum efct_hw_io_count_type { 46262306a36Sopenharmony_ci EFCT_HW_IO_INUSE_COUNT, 46362306a36Sopenharmony_ci EFCT_HW_IO_FREE_COUNT, 46462306a36Sopenharmony_ci EFCT_HW_IO_WAIT_FREE_COUNT, 46562306a36Sopenharmony_ci EFCT_HW_IO_N_TOTAL_IO_COUNT, 46662306a36Sopenharmony_ci}; 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci/* HW queue data structures */ 46962306a36Sopenharmony_cistruct hw_eq { 47062306a36Sopenharmony_ci struct list_head list_entry; 47162306a36Sopenharmony_ci enum sli4_qtype type; 47262306a36Sopenharmony_ci u32 instance; 47362306a36Sopenharmony_ci u32 entry_count; 47462306a36Sopenharmony_ci u32 entry_size; 47562306a36Sopenharmony_ci struct efct_hw *hw; 47662306a36Sopenharmony_ci struct sli4_queue *queue; 47762306a36Sopenharmony_ci struct list_head cq_list; 47862306a36Sopenharmony_ci u32 use_count; 47962306a36Sopenharmony_ci}; 48062306a36Sopenharmony_ci 48162306a36Sopenharmony_cistruct hw_cq { 48262306a36Sopenharmony_ci struct list_head list_entry; 48362306a36Sopenharmony_ci enum sli4_qtype type; 48462306a36Sopenharmony_ci u32 instance; 48562306a36Sopenharmony_ci u32 entry_count; 48662306a36Sopenharmony_ci u32 entry_size; 48762306a36Sopenharmony_ci struct hw_eq *eq; 48862306a36Sopenharmony_ci struct sli4_queue *queue; 48962306a36Sopenharmony_ci struct list_head q_list; 49062306a36Sopenharmony_ci u32 use_count; 49162306a36Sopenharmony_ci}; 49262306a36Sopenharmony_ci 49362306a36Sopenharmony_cistruct hw_q { 49462306a36Sopenharmony_ci struct list_head list_entry; 49562306a36Sopenharmony_ci enum sli4_qtype type; 49662306a36Sopenharmony_ci}; 49762306a36Sopenharmony_ci 49862306a36Sopenharmony_cistruct hw_mq { 49962306a36Sopenharmony_ci struct list_head list_entry; 50062306a36Sopenharmony_ci enum sli4_qtype type; 50162306a36Sopenharmony_ci u32 instance; 50262306a36Sopenharmony_ci 50362306a36Sopenharmony_ci u32 entry_count; 50462306a36Sopenharmony_ci u32 entry_size; 50562306a36Sopenharmony_ci struct hw_cq *cq; 50662306a36Sopenharmony_ci struct sli4_queue *queue; 50762306a36Sopenharmony_ci 50862306a36Sopenharmony_ci u32 use_count; 50962306a36Sopenharmony_ci}; 51062306a36Sopenharmony_ci 51162306a36Sopenharmony_cistruct hw_wq { 51262306a36Sopenharmony_ci struct list_head list_entry; 51362306a36Sopenharmony_ci enum sli4_qtype type; 51462306a36Sopenharmony_ci u32 instance; 51562306a36Sopenharmony_ci struct efct_hw *hw; 51662306a36Sopenharmony_ci 51762306a36Sopenharmony_ci u32 entry_count; 51862306a36Sopenharmony_ci u32 entry_size; 51962306a36Sopenharmony_ci struct hw_cq *cq; 52062306a36Sopenharmony_ci struct sli4_queue *queue; 52162306a36Sopenharmony_ci u32 class; 52262306a36Sopenharmony_ci 52362306a36Sopenharmony_ci /* WQ consumed */ 52462306a36Sopenharmony_ci u32 wqec_set_count; 52562306a36Sopenharmony_ci u32 wqec_count; 52662306a36Sopenharmony_ci u32 free_count; 52762306a36Sopenharmony_ci u32 total_submit_count; 52862306a36Sopenharmony_ci struct list_head pending_list; 52962306a36Sopenharmony_ci 53062306a36Sopenharmony_ci /* HW IO allocated for use with Send Frame */ 53162306a36Sopenharmony_ci struct efct_hw_io *send_frame_io; 53262306a36Sopenharmony_ci 53362306a36Sopenharmony_ci /* Stats */ 53462306a36Sopenharmony_ci u32 use_count; 53562306a36Sopenharmony_ci u32 wq_pending_count; 53662306a36Sopenharmony_ci}; 53762306a36Sopenharmony_ci 53862306a36Sopenharmony_cistruct hw_rq { 53962306a36Sopenharmony_ci struct list_head list_entry; 54062306a36Sopenharmony_ci enum sli4_qtype type; 54162306a36Sopenharmony_ci u32 instance; 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_ci u32 entry_count; 54462306a36Sopenharmony_ci u32 use_count; 54562306a36Sopenharmony_ci u32 hdr_entry_size; 54662306a36Sopenharmony_ci u32 first_burst_entry_size; 54762306a36Sopenharmony_ci u32 data_entry_size; 54862306a36Sopenharmony_ci bool is_mrq; 54962306a36Sopenharmony_ci u32 base_mrq_id; 55062306a36Sopenharmony_ci 55162306a36Sopenharmony_ci struct hw_cq *cq; 55262306a36Sopenharmony_ci 55362306a36Sopenharmony_ci u8 filter_mask; 55462306a36Sopenharmony_ci struct sli4_queue *hdr; 55562306a36Sopenharmony_ci struct sli4_queue *first_burst; 55662306a36Sopenharmony_ci struct sli4_queue *data; 55762306a36Sopenharmony_ci 55862306a36Sopenharmony_ci struct efc_hw_rq_buffer *hdr_buf; 55962306a36Sopenharmony_ci struct efc_hw_rq_buffer *fb_buf; 56062306a36Sopenharmony_ci struct efc_hw_rq_buffer *payload_buf; 56162306a36Sopenharmony_ci /* RQ tracker for this RQ */ 56262306a36Sopenharmony_ci struct efc_hw_sequence **rq_tracker; 56362306a36Sopenharmony_ci}; 56462306a36Sopenharmony_ci 56562306a36Sopenharmony_cistruct efct_hw_send_frame_context { 56662306a36Sopenharmony_ci struct efct_hw *hw; 56762306a36Sopenharmony_ci struct hw_wq_callback *wqcb; 56862306a36Sopenharmony_ci struct efct_hw_wqe wqe; 56962306a36Sopenharmony_ci void (*callback)(int status, void *arg); 57062306a36Sopenharmony_ci void *arg; 57162306a36Sopenharmony_ci 57262306a36Sopenharmony_ci /* General purpose elements */ 57362306a36Sopenharmony_ci struct efc_hw_sequence *seq; 57462306a36Sopenharmony_ci struct efc_dma payload; 57562306a36Sopenharmony_ci}; 57662306a36Sopenharmony_ci 57762306a36Sopenharmony_cistruct efct_hw_grp_hdr { 57862306a36Sopenharmony_ci u32 size; 57962306a36Sopenharmony_ci __be32 magic_number; 58062306a36Sopenharmony_ci u32 word2; 58162306a36Sopenharmony_ci u8 rev_name[128]; 58262306a36Sopenharmony_ci u8 date[12]; 58362306a36Sopenharmony_ci u8 revision[32]; 58462306a36Sopenharmony_ci}; 58562306a36Sopenharmony_ci 58662306a36Sopenharmony_cistatic inline int 58762306a36Sopenharmony_ciefct_hw_get_link_speed(struct efct_hw *hw) { 58862306a36Sopenharmony_ci return hw->link.speed; 58962306a36Sopenharmony_ci} 59062306a36Sopenharmony_ci 59162306a36Sopenharmony_ciint 59262306a36Sopenharmony_ciefct_hw_setup(struct efct_hw *hw, void *os, struct pci_dev *pdev); 59362306a36Sopenharmony_ciint efct_hw_init(struct efct_hw *hw); 59462306a36Sopenharmony_ciint 59562306a36Sopenharmony_ciefct_hw_parse_filter(struct efct_hw *hw, void *value); 59662306a36Sopenharmony_ciint 59762306a36Sopenharmony_ciefct_hw_init_queues(struct efct_hw *hw); 59862306a36Sopenharmony_ciint 59962306a36Sopenharmony_ciefct_hw_map_wq_cpu(struct efct_hw *hw); 60062306a36Sopenharmony_ciuint64_t 60162306a36Sopenharmony_ciefct_get_wwnn(struct efct_hw *hw); 60262306a36Sopenharmony_ciuint64_t 60362306a36Sopenharmony_ciefct_get_wwpn(struct efct_hw *hw); 60462306a36Sopenharmony_ci 60562306a36Sopenharmony_ciint efct_hw_rx_allocate(struct efct_hw *hw); 60662306a36Sopenharmony_ciint efct_hw_rx_post(struct efct_hw *hw); 60762306a36Sopenharmony_civoid efct_hw_rx_free(struct efct_hw *hw); 60862306a36Sopenharmony_ciint 60962306a36Sopenharmony_ciefct_hw_command(struct efct_hw *hw, u8 *cmd, u32 opts, void *cb, 61062306a36Sopenharmony_ci void *arg); 61162306a36Sopenharmony_ciint 61262306a36Sopenharmony_ciefct_issue_mbox_rqst(void *base, void *cmd, void *cb, void *arg); 61362306a36Sopenharmony_ci 61462306a36Sopenharmony_cistruct efct_hw_io *efct_hw_io_alloc(struct efct_hw *hw); 61562306a36Sopenharmony_ciint efct_hw_io_free(struct efct_hw *hw, struct efct_hw_io *io); 61662306a36Sopenharmony_ciu8 efct_hw_io_inuse(struct efct_hw *hw, struct efct_hw_io *io); 61762306a36Sopenharmony_ciint 61862306a36Sopenharmony_ciefct_hw_io_send(struct efct_hw *hw, enum efct_hw_io_type type, 61962306a36Sopenharmony_ci struct efct_hw_io *io, union efct_hw_io_param_u *iparam, 62062306a36Sopenharmony_ci void *cb, void *arg); 62162306a36Sopenharmony_ciint 62262306a36Sopenharmony_ciefct_hw_io_register_sgl(struct efct_hw *hw, struct efct_hw_io *io, 62362306a36Sopenharmony_ci struct efc_dma *sgl, 62462306a36Sopenharmony_ci u32 sgl_count); 62562306a36Sopenharmony_ciint 62662306a36Sopenharmony_ciefct_hw_io_init_sges(struct efct_hw *hw, 62762306a36Sopenharmony_ci struct efct_hw_io *io, enum efct_hw_io_type type); 62862306a36Sopenharmony_ci 62962306a36Sopenharmony_ciint 63062306a36Sopenharmony_ciefct_hw_io_add_sge(struct efct_hw *hw, struct efct_hw_io *io, 63162306a36Sopenharmony_ci uintptr_t addr, u32 length); 63262306a36Sopenharmony_ciint 63362306a36Sopenharmony_ciefct_hw_io_abort(struct efct_hw *hw, struct efct_hw_io *io_to_abort, 63462306a36Sopenharmony_ci bool send_abts, void *cb, void *arg); 63562306a36Sopenharmony_ciu32 63662306a36Sopenharmony_ciefct_hw_io_get_count(struct efct_hw *hw, 63762306a36Sopenharmony_ci enum efct_hw_io_count_type io_count_type); 63862306a36Sopenharmony_cistruct efct_hw_io 63962306a36Sopenharmony_ci*efct_hw_io_lookup(struct efct_hw *hw, u32 indicator); 64062306a36Sopenharmony_civoid efct_hw_io_abort_all(struct efct_hw *hw); 64162306a36Sopenharmony_civoid efct_hw_io_free_internal(struct kref *arg); 64262306a36Sopenharmony_ci 64362306a36Sopenharmony_ci/* HW WQ request tag API */ 64462306a36Sopenharmony_cistruct reqtag_pool *efct_hw_reqtag_pool_alloc(struct efct_hw *hw); 64562306a36Sopenharmony_civoid efct_hw_reqtag_pool_free(struct efct_hw *hw); 64662306a36Sopenharmony_cistruct hw_wq_callback 64762306a36Sopenharmony_ci*efct_hw_reqtag_alloc(struct efct_hw *hw, 64862306a36Sopenharmony_ci void (*callback)(void *arg, u8 *cqe, 64962306a36Sopenharmony_ci int status), void *arg); 65062306a36Sopenharmony_civoid 65162306a36Sopenharmony_ciefct_hw_reqtag_free(struct efct_hw *hw, struct hw_wq_callback *wqcb); 65262306a36Sopenharmony_cistruct hw_wq_callback 65362306a36Sopenharmony_ci*efct_hw_reqtag_get_instance(struct efct_hw *hw, u32 instance_index); 65462306a36Sopenharmony_ci 65562306a36Sopenharmony_ci/* RQ completion handlers for RQ pair mode */ 65662306a36Sopenharmony_ciint 65762306a36Sopenharmony_ciefct_hw_rqpair_process_rq(struct efct_hw *hw, 65862306a36Sopenharmony_ci struct hw_cq *cq, u8 *cqe); 65962306a36Sopenharmony_ciint 66062306a36Sopenharmony_ciefct_hw_rqpair_sequence_free(struct efct_hw *hw, struct efc_hw_sequence *seq); 66162306a36Sopenharmony_cistatic inline void 66262306a36Sopenharmony_ciefct_hw_sequence_copy(struct efc_hw_sequence *dst, 66362306a36Sopenharmony_ci struct efc_hw_sequence *src) 66462306a36Sopenharmony_ci{ 66562306a36Sopenharmony_ci /* Copy src to dst, then zero out the linked list link */ 66662306a36Sopenharmony_ci *dst = *src; 66762306a36Sopenharmony_ci} 66862306a36Sopenharmony_ci 66962306a36Sopenharmony_ciint 67062306a36Sopenharmony_ciefct_efc_hw_sequence_free(struct efc *efc, struct efc_hw_sequence *seq); 67162306a36Sopenharmony_ci 67262306a36Sopenharmony_cistatic inline int 67362306a36Sopenharmony_ciefct_hw_sequence_free(struct efct_hw *hw, struct efc_hw_sequence *seq) 67462306a36Sopenharmony_ci{ 67562306a36Sopenharmony_ci /* Only RQ pair mode is supported */ 67662306a36Sopenharmony_ci return efct_hw_rqpair_sequence_free(hw, seq); 67762306a36Sopenharmony_ci} 67862306a36Sopenharmony_ci 67962306a36Sopenharmony_ciint 68062306a36Sopenharmony_ciefct_hw_eq_process(struct efct_hw *hw, struct hw_eq *eq, 68162306a36Sopenharmony_ci u32 max_isr_time_msec); 68262306a36Sopenharmony_civoid efct_hw_cq_process(struct efct_hw *hw, struct hw_cq *cq); 68362306a36Sopenharmony_civoid 68462306a36Sopenharmony_ciefct_hw_wq_process(struct efct_hw *hw, struct hw_cq *cq, 68562306a36Sopenharmony_ci u8 *cqe, int status, u16 rid); 68662306a36Sopenharmony_civoid 68762306a36Sopenharmony_ciefct_hw_xabt_process(struct efct_hw *hw, struct hw_cq *cq, 68862306a36Sopenharmony_ci u8 *cqe, u16 rid); 68962306a36Sopenharmony_ciint 69062306a36Sopenharmony_ciefct_hw_process(struct efct_hw *hw, u32 vector, u32 max_isr_time_msec); 69162306a36Sopenharmony_ciint 69262306a36Sopenharmony_ciefct_hw_queue_hash_find(struct efct_queue_hash *hash, u16 id); 69362306a36Sopenharmony_ciint efct_hw_wq_write(struct hw_wq *wq, struct efct_hw_wqe *wqe); 69462306a36Sopenharmony_ciint 69562306a36Sopenharmony_ciefct_hw_send_frame(struct efct_hw *hw, struct fc_frame_header *hdr, 69662306a36Sopenharmony_ci u8 sof, u8 eof, struct efc_dma *payload, 69762306a36Sopenharmony_ci struct efct_hw_send_frame_context *ctx, 69862306a36Sopenharmony_ci void (*callback)(void *arg, u8 *cqe, int status), 69962306a36Sopenharmony_ci void *arg); 70062306a36Sopenharmony_ciint 70162306a36Sopenharmony_ciefct_els_hw_srrs_send(struct efc *efc, struct efc_disc_io *io); 70262306a36Sopenharmony_ciint 70362306a36Sopenharmony_ciefct_efc_bls_send(struct efc *efc, u32 type, struct sli_bls_params *bls); 70462306a36Sopenharmony_ciint 70562306a36Sopenharmony_ciefct_hw_bls_send(struct efct *efct, u32 type, struct sli_bls_params *bls_params, 70662306a36Sopenharmony_ci void *cb, void *arg); 70762306a36Sopenharmony_ci 70862306a36Sopenharmony_ci/* Function for retrieving link statistics */ 70962306a36Sopenharmony_ciint 71062306a36Sopenharmony_ciefct_hw_get_link_stats(struct efct_hw *hw, 71162306a36Sopenharmony_ci u8 req_ext_counters, 71262306a36Sopenharmony_ci u8 clear_overflow_flags, 71362306a36Sopenharmony_ci u8 clear_all_counters, 71462306a36Sopenharmony_ci void (*efct_hw_link_stat_cb_t)(int status, 71562306a36Sopenharmony_ci u32 num_counters, 71662306a36Sopenharmony_ci struct efct_hw_link_stat_counts *counters, void *arg), 71762306a36Sopenharmony_ci void *arg); 71862306a36Sopenharmony_ci/* Function for retrieving host statistics */ 71962306a36Sopenharmony_ciint 72062306a36Sopenharmony_ciefct_hw_get_host_stats(struct efct_hw *hw, 72162306a36Sopenharmony_ci u8 cc, 72262306a36Sopenharmony_ci void (*efct_hw_host_stat_cb_t)(int status, 72362306a36Sopenharmony_ci u32 num_counters, 72462306a36Sopenharmony_ci struct efct_hw_host_stat_counts *counters, void *arg), 72562306a36Sopenharmony_ci void *arg); 72662306a36Sopenharmony_ciint 72762306a36Sopenharmony_ciefct_hw_firmware_write(struct efct_hw *hw, struct efc_dma *dma, 72862306a36Sopenharmony_ci u32 size, u32 offset, int last, 72962306a36Sopenharmony_ci void (*cb)(int status, u32 bytes_written, 73062306a36Sopenharmony_ci u32 change_status, void *arg), 73162306a36Sopenharmony_ci void *arg); 73262306a36Sopenharmony_citypedef void (*efct_hw_async_cb_t)(struct efct_hw *hw, int status, 73362306a36Sopenharmony_ci u8 *mqe, void *arg); 73462306a36Sopenharmony_ciint 73562306a36Sopenharmony_ciefct_hw_async_call(struct efct_hw *hw, efct_hw_async_cb_t callback, void *arg); 73662306a36Sopenharmony_ci 73762306a36Sopenharmony_cistruct hw_eq *efct_hw_new_eq(struct efct_hw *hw, u32 entry_count); 73862306a36Sopenharmony_cistruct hw_cq *efct_hw_new_cq(struct hw_eq *eq, u32 entry_count); 73962306a36Sopenharmony_ciu32 74062306a36Sopenharmony_ciefct_hw_new_cq_set(struct hw_eq *eqs[], struct hw_cq *cqs[], 74162306a36Sopenharmony_ci u32 num_cqs, u32 entry_count); 74262306a36Sopenharmony_cistruct hw_mq *efct_hw_new_mq(struct hw_cq *cq, u32 entry_count); 74362306a36Sopenharmony_cistruct hw_wq 74462306a36Sopenharmony_ci*efct_hw_new_wq(struct hw_cq *cq, u32 entry_count); 74562306a36Sopenharmony_ciu32 74662306a36Sopenharmony_ciefct_hw_new_rq_set(struct hw_cq *cqs[], struct hw_rq *rqs[], 74762306a36Sopenharmony_ci u32 num_rq_pairs, u32 entry_count); 74862306a36Sopenharmony_civoid efct_hw_del_eq(struct hw_eq *eq); 74962306a36Sopenharmony_civoid efct_hw_del_cq(struct hw_cq *cq); 75062306a36Sopenharmony_civoid efct_hw_del_mq(struct hw_mq *mq); 75162306a36Sopenharmony_civoid efct_hw_del_wq(struct hw_wq *wq); 75262306a36Sopenharmony_civoid efct_hw_del_rq(struct hw_rq *rq); 75362306a36Sopenharmony_civoid efct_hw_queue_teardown(struct efct_hw *hw); 75462306a36Sopenharmony_civoid efct_hw_teardown(struct efct_hw *hw); 75562306a36Sopenharmony_ciint 75662306a36Sopenharmony_ciefct_hw_reset(struct efct_hw *hw, enum efct_hw_reset reset); 75762306a36Sopenharmony_ci 75862306a36Sopenharmony_ciint 75962306a36Sopenharmony_ciefct_hw_port_control(struct efct_hw *hw, enum efct_hw_port ctrl, 76062306a36Sopenharmony_ci uintptr_t value, 76162306a36Sopenharmony_ci void (*cb)(int status, uintptr_t value, void *arg), 76262306a36Sopenharmony_ci void *arg); 76362306a36Sopenharmony_ci 76462306a36Sopenharmony_ci#endif /* __EFCT_H__ */ 765