1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright(c) 2019-2021 Xilinx, Inc.
4 * Copyright(c) 2016-2019 Solarflare Communications Inc.
6 * This software was jointly developed between OKTET Labs (under contract
7 * for Solarflare) and Solarflare Communications, Inc.
10 #ifndef _SFC_EFX_MCDI_H
11 #define _SFC_EFX_MCDI_H
15 #include <rte_spinlock.h>
25 enum sfc_efx_mcdi_state {
26 SFC_EFX_MCDI_UNINITIALIZED = 0,
27 SFC_EFX_MCDI_INITIALIZED,
29 SFC_EFX_MCDI_COMPLETED,
35 typedef int (sfc_efx_mcdi_dma_alloc_cb)(void *cookie, const char *name,
36 size_t len, efsys_mem_t *esmp);
38 typedef void (sfc_efx_mcdi_dma_free_cb)(void *cookie, efsys_mem_t *esmp);
40 typedef void (sfc_efx_mcdi_sched_restart_cb)(void *cookie);
42 typedef void (sfc_efx_mcdi_mgmt_evq_poll_cb)(void *cookie);
44 struct sfc_efx_mcdi_ops {
45 sfc_efx_mcdi_dma_alloc_cb *dma_alloc;
46 sfc_efx_mcdi_dma_free_cb *dma_free;
47 sfc_efx_mcdi_sched_restart_cb *sched_restart;
48 sfc_efx_mcdi_mgmt_evq_poll_cb *mgmt_evq_poll;
53 const struct sfc_efx_mcdi_ops *ops;
57 enum sfc_efx_mcdi_state state;
58 efx_mcdi_transport_t transport;
60 uint32_t proxy_handle;
61 efx_rc_t proxy_result;
62 const char *log_prefix;
66 int sfc_efx_mcdi_init(struct sfc_efx_mcdi *mcdi,
67 uint32_t logtype, const char *log_prefix,
69 const struct sfc_efx_mcdi_ops *ops, void *ops_cookie);
71 void sfc_efx_mcdi_fini(struct sfc_efx_mcdi *mcdi);
77 #endif /* _SFC_EFX_MCDI_H */