Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Driver for Solarflare network controllers and boards
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright 2008-2013 Solarflare Communications Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #ifndef EFX_MCDI_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #define EFX_MCDI_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * enum efx_mcdi_state - MCDI request handling state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * @MCDI_STATE_QUIESCENT: No pending MCDI requests. If the caller holds the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *	mcdi @iface_lock then they are able to move to %MCDI_STATE_RUNNING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * @MCDI_STATE_RUNNING_SYNC: There is a synchronous MCDI request pending.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *	Only the thread that moved into this state is allowed to move out of it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * @MCDI_STATE_RUNNING_ASYNC: There is an asynchronous MCDI request pending.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * @MCDI_STATE_PROXY_WAIT: An MCDI request has completed with a response that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *	indicates we must wait for a proxy try again message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * @MCDI_STATE_COMPLETED: An MCDI request has completed, but the owning thread
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *	has not yet consumed the result. For all other threads, equivalent to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *	%MCDI_STATE_RUNNING.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) enum efx_mcdi_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	MCDI_STATE_QUIESCENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	MCDI_STATE_RUNNING_SYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	MCDI_STATE_RUNNING_ASYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	MCDI_STATE_PROXY_WAIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	MCDI_STATE_COMPLETED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * enum efx_mcdi_mode - MCDI transaction mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * @MCDI_MODE_POLL: poll for MCDI completion, until timeout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * @MCDI_MODE_EVENTS: wait for an mcdi_event.  On timeout, poll once
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * @MCDI_MODE_FAIL: we think MCDI is dead, so fail-fast all calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) enum efx_mcdi_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	MCDI_MODE_POLL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	MCDI_MODE_EVENTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	MCDI_MODE_FAIL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * struct efx_mcdi_iface - MCDI protocol context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * @efx: The associated NIC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  * @state: Request handling state. Waited for by @wq.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * @mode: Poll for mcdi completion, or wait for an mcdi_event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * @wq: Wait queue for threads waiting for @state != %MCDI_STATE_RUNNING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * @new_epoch: Indicates start of day or start of MC reboot recovery
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * @iface_lock: Serialises access to @seqno, @credits and response metadata
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  * @seqno: The next sequence number to use for mcdi requests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  * @credits: Number of spurious MCDI completion events allowed before we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  *     trigger a fatal error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * @resprc: Response error/success code (Linux numbering)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * @resp_hdr_len: Response header length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * @resp_data_len: Response data (SDU or error) length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * @async_lock: Serialises access to @async_list while event processing is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  *	enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * @async_list: Queue of asynchronous requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * @async_timer: Timer for asynchronous request timeout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * @logging_buffer: buffer that may be used to build MCDI tracing messages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * @logging_enabled: whether to trace MCDI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  * @proxy_rx_handle: Most recently received proxy authorisation handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * @proxy_rx_status: Status of most recent proxy authorisation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * @proxy_rx_wq: Wait queue for updates to proxy_rx_handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) struct efx_mcdi_iface {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	struct efx_nic *efx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	enum efx_mcdi_state state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	enum efx_mcdi_mode mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	wait_queue_head_t wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	spinlock_t iface_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	bool new_epoch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	unsigned int credits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	unsigned int seqno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	int resprc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	int resprc_raw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	size_t resp_hdr_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	size_t resp_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	spinlock_t async_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	struct list_head async_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	struct timer_list async_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #ifdef CONFIG_SFC_MCDI_LOGGING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	char *logging_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	bool logging_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	unsigned int proxy_rx_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	int proxy_rx_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	wait_queue_head_t proxy_rx_wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) struct efx_mcdi_mon {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	struct efx_buffer dma_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	struct mutex update_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	unsigned long last_update;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	struct device *device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	struct efx_mcdi_mon_attribute *attrs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	struct attribute_group group;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	const struct attribute_group *groups[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	unsigned int n_attrs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) struct efx_mcdi_mtd_partition {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	struct efx_mtd_partition common;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	bool updating;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	u16 nvram_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	u16 fw_subtype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #define to_efx_mcdi_mtd_partition(mtd)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	container_of(mtd, struct efx_mcdi_mtd_partition, common.mtd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)  * struct efx_mcdi_data - extra state for NICs that implement MCDI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  * @iface: Interface/protocol state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)  * @hwmon: Hardware monitor state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  * @fn_flags: Flags for this function, as returned by %MC_CMD_DRV_ATTACH.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct efx_mcdi_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	struct efx_mcdi_iface iface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #ifdef CONFIG_SFC_MCDI_MON
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	struct efx_mcdi_mon hwmon;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	u32 fn_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	EFX_WARN_ON_PARANOID(!efx->mcdi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	return &efx->mcdi->iface;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #ifdef CONFIG_SFC_MCDI_MON
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) static inline struct efx_mcdi_mon *efx_mcdi_mon(struct efx_nic *efx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	EFX_WARN_ON_PARANOID(!efx->mcdi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	return &efx->mcdi->hwmon;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) int efx_mcdi_init(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) void efx_mcdi_detach(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) void efx_mcdi_fini(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, const efx_dword_t *inbuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		 size_t inlen, efx_dword_t *outbuf, size_t outlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		 size_t *outlen_actual);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		       const efx_dword_t *inbuf, size_t inlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		       efx_dword_t *outbuf, size_t outlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		       size_t *outlen_actual);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		       const efx_dword_t *inbuf, size_t inlen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 			efx_dword_t *outbuf, size_t outlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			size_t *outlen_actual);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) int efx_mcdi_rpc_finish_quiet(struct efx_nic *efx, unsigned cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 			      size_t inlen, efx_dword_t *outbuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 			      size_t outlen, size_t *outlen_actual);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) typedef void efx_mcdi_async_completer(struct efx_nic *efx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 				      unsigned long cookie, int rc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 				      efx_dword_t *outbuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 				      size_t outlen_actual);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) int efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		       const efx_dword_t *inbuf, size_t inlen, size_t outlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		       efx_mcdi_async_completer *complete,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		       unsigned long cookie);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) int efx_mcdi_rpc_async_quiet(struct efx_nic *efx, unsigned int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 			     const efx_dword_t *inbuf, size_t inlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 			     size_t outlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 			     efx_mcdi_async_completer *complete,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 			     unsigned long cookie);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) void efx_mcdi_display_error(struct efx_nic *efx, unsigned cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 			    size_t inlen, efx_dword_t *outbuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 			    size_t outlen, int rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) int efx_mcdi_poll_reboot(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) void efx_mcdi_mode_poll(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) void efx_mcdi_mode_event(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) void efx_mcdi_flush_async(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) void efx_mcdi_process_event(struct efx_channel *channel, efx_qword_t *event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) /* We expect that 16- and 32-bit fields in MCDI requests and responses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  * are appropriately aligned, but 64-bit fields are only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  * 32-bit-aligned.  Also, on Siena we must copy to the MC shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  * memory strictly 32 bits at a time, so add any necessary padding.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) #define MCDI_TX_BUF_LEN(_len) DIV_ROUND_UP((_len), 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #define _MCDI_DECLARE_BUF(_name, _len)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	efx_dword_t _name[DIV_ROUND_UP(_len, 4)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) #define MCDI_DECLARE_BUF(_name, _len)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	_MCDI_DECLARE_BUF(_name, _len) = {{{0}}}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #define MCDI_DECLARE_BUF_ERR(_name)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	MCDI_DECLARE_BUF(_name, 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #define _MCDI_PTR(_buf, _offset)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	((u8 *)(_buf) + (_offset))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #define MCDI_PTR(_buf, _field)						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	_MCDI_PTR(_buf, MC_CMD_ ## _field ## _OFST)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) #define _MCDI_CHECK_ALIGN(_ofst, _align)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	((_ofst) + BUILD_BUG_ON_ZERO((_ofst) & (_align - 1)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) #define _MCDI_DWORD(_buf, _field)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	((_buf) + (_MCDI_CHECK_ALIGN(MC_CMD_ ## _field ## _OFST, 4) >> 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) #define MCDI_BYTE(_buf, _field)						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	((void)BUILD_BUG_ON_ZERO(MC_CMD_ ## _field ## _LEN != 1),	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	 *MCDI_PTR(_buf, _field))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) #define MCDI_WORD(_buf, _field)						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	((u16)BUILD_BUG_ON_ZERO(MC_CMD_ ## _field ## _LEN != 2) +	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	 le16_to_cpu(*(__force const __le16 *)MCDI_PTR(_buf, _field)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) #define MCDI_SET_DWORD(_buf, _field, _value)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	EFX_POPULATE_DWORD_1(*_MCDI_DWORD(_buf, _field), EFX_DWORD_0, _value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) #define MCDI_DWORD(_buf, _field)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	EFX_DWORD_FIELD(*_MCDI_DWORD(_buf, _field), EFX_DWORD_0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) #define MCDI_POPULATE_DWORD_1(_buf, _field, _name1, _value1)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	EFX_POPULATE_DWORD_1(*_MCDI_DWORD(_buf, _field),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 			     MC_CMD_ ## _name1, _value1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) #define MCDI_POPULATE_DWORD_2(_buf, _field, _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 			      _name2, _value2)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	EFX_POPULATE_DWORD_2(*_MCDI_DWORD(_buf, _field),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 			     MC_CMD_ ## _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 			     MC_CMD_ ## _name2, _value2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) #define MCDI_POPULATE_DWORD_3(_buf, _field, _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			      _name2, _value2, _name3, _value3)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	EFX_POPULATE_DWORD_3(*_MCDI_DWORD(_buf, _field),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 			     MC_CMD_ ## _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 			     MC_CMD_ ## _name2, _value2,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 			     MC_CMD_ ## _name3, _value3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) #define MCDI_POPULATE_DWORD_4(_buf, _field, _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			      _name2, _value2, _name3, _value3,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 			      _name4, _value4)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	EFX_POPULATE_DWORD_4(*_MCDI_DWORD(_buf, _field),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 			     MC_CMD_ ## _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 			     MC_CMD_ ## _name2, _value2,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 			     MC_CMD_ ## _name3, _value3,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 			     MC_CMD_ ## _name4, _value4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) #define MCDI_POPULATE_DWORD_5(_buf, _field, _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 			      _name2, _value2, _name3, _value3,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 			      _name4, _value4, _name5, _value5)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	EFX_POPULATE_DWORD_5(*_MCDI_DWORD(_buf, _field),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 			     MC_CMD_ ## _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 			     MC_CMD_ ## _name2, _value2,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 			     MC_CMD_ ## _name3, _value3,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 			     MC_CMD_ ## _name4, _value4,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 			     MC_CMD_ ## _name5, _value5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) #define MCDI_POPULATE_DWORD_6(_buf, _field, _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 			      _name2, _value2, _name3, _value3,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 			      _name4, _value4, _name5, _value5,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 			      _name6, _value6)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	EFX_POPULATE_DWORD_6(*_MCDI_DWORD(_buf, _field),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 			     MC_CMD_ ## _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 			     MC_CMD_ ## _name2, _value2,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 			     MC_CMD_ ## _name3, _value3,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 			     MC_CMD_ ## _name4, _value4,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 			     MC_CMD_ ## _name5, _value5,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 			     MC_CMD_ ## _name6, _value6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) #define MCDI_POPULATE_DWORD_7(_buf, _field, _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 			      _name2, _value2, _name3, _value3,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 			      _name4, _value4, _name5, _value5,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 			      _name6, _value6, _name7, _value7)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	EFX_POPULATE_DWORD_7(*_MCDI_DWORD(_buf, _field),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 			     MC_CMD_ ## _name1, _value1,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 			     MC_CMD_ ## _name2, _value2,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 			     MC_CMD_ ## _name3, _value3,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 			     MC_CMD_ ## _name4, _value4,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 			     MC_CMD_ ## _name5, _value5,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 			     MC_CMD_ ## _name6, _value6,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 			     MC_CMD_ ## _name7, _value7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #define MCDI_SET_QWORD(_buf, _field, _value)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	do {								\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		EFX_POPULATE_DWORD_1(_MCDI_DWORD(_buf, _field)[0],	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 				     EFX_DWORD_0, (u32)(_value));	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 		EFX_POPULATE_DWORD_1(_MCDI_DWORD(_buf, _field)[1],	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 				     EFX_DWORD_0, (u64)(_value) >> 32);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) #define MCDI_QWORD(_buf, _field)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	(EFX_DWORD_FIELD(_MCDI_DWORD(_buf, _field)[0], EFX_DWORD_0) |	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	(u64)EFX_DWORD_FIELD(_MCDI_DWORD(_buf, _field)[1], EFX_DWORD_0) << 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) #define MCDI_FIELD(_ptr, _type, _field)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	EFX_EXTRACT_DWORD(						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 		*(efx_dword_t *)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 		_MCDI_PTR(_ptr, MC_CMD_ ## _type ## _ ## _field ## _OFST & ~3),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 		MC_CMD_ ## _type ## _ ## _field ## _LBN & 0x1f,	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 		(MC_CMD_ ## _type ## _ ## _field ## _LBN & 0x1f) +	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 		MC_CMD_ ## _type ## _ ## _field ## _WIDTH - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) #define _MCDI_ARRAY_PTR(_buf, _field, _index, _align)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	(_MCDI_PTR(_buf, _MCDI_CHECK_ALIGN(MC_CMD_ ## _field ## _OFST, _align))\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	 + (_index) * _MCDI_CHECK_ALIGN(MC_CMD_ ## _field ## _LEN, _align))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) #define MCDI_DECLARE_STRUCT_PTR(_name)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	efx_dword_t *_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) #define MCDI_ARRAY_STRUCT_PTR(_buf, _field, _index)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	((efx_dword_t *)_MCDI_ARRAY_PTR(_buf, _field, _index, 4))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) #define MCDI_VAR_ARRAY_LEN(_len, _field)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	min_t(size_t, MC_CMD_ ## _field ## _MAXNUM,			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	      ((_len) - MC_CMD_ ## _field ## _OFST) / MC_CMD_ ## _field ## _LEN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) #define MCDI_ARRAY_WORD(_buf, _field, _index)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	(BUILD_BUG_ON_ZERO(MC_CMD_ ## _field ## _LEN != 2) +		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	 le16_to_cpu(*(__force const __le16 *)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 		     _MCDI_ARRAY_PTR(_buf, _field, _index, 2)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) #define _MCDI_ARRAY_DWORD(_buf, _field, _index)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	(BUILD_BUG_ON_ZERO(MC_CMD_ ## _field ## _LEN != 4) +		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	 (efx_dword_t *)_MCDI_ARRAY_PTR(_buf, _field, _index, 4))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) #define MCDI_SET_ARRAY_DWORD(_buf, _field, _index, _value)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	EFX_SET_DWORD_FIELD(*_MCDI_ARRAY_DWORD(_buf, _field, _index),	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 			    EFX_DWORD_0, _value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) #define MCDI_ARRAY_DWORD(_buf, _field, _index)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	EFX_DWORD_FIELD(*_MCDI_ARRAY_DWORD(_buf, _field, _index), EFX_DWORD_0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) #define _MCDI_ARRAY_QWORD(_buf, _field, _index)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	(BUILD_BUG_ON_ZERO(MC_CMD_ ## _field ## _LEN != 8) +		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	 (efx_dword_t *)_MCDI_ARRAY_PTR(_buf, _field, _index, 4))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) #define MCDI_SET_ARRAY_QWORD(_buf, _field, _index, _value)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	do {								\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 		EFX_SET_DWORD_FIELD(_MCDI_ARRAY_QWORD(_buf, _field, _index)[0],\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 				    EFX_DWORD_0, (u32)(_value));	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 		EFX_SET_DWORD_FIELD(_MCDI_ARRAY_QWORD(_buf, _field, _index)[1],\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 				    EFX_DWORD_0, (u64)(_value) >> 32);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) #define MCDI_ARRAY_FIELD(_buf, _field1, _type, _index, _field2)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	MCDI_FIELD(MCDI_ARRAY_STRUCT_PTR(_buf, _field1, _index),	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 		   _type ## _TYPEDEF, _field2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) #define MCDI_EVENT_FIELD(_ev, _field)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) #define MCDI_CAPABILITY(field)						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	MC_CMD_GET_CAPABILITIES_V8_OUT_ ## field ## _LBN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) #define MCDI_CAPABILITY_OFST(field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	MC_CMD_GET_CAPABILITIES_V8_OUT_ ## field ## _OFST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) #define efx_has_cap(efx, field) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	efx->type->check_caps(efx, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 			      MCDI_CAPABILITY(field), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 			      MCDI_CAPABILITY_OFST(field))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 			   u16 *fw_subtype_list, u32 *capabilities);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) int efx_mcdi_log_ctrl(struct efx_nic *efx, bool evq, bool uart, u32 dest_evq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) int efx_mcdi_nvram_types(struct efx_nic *efx, u32 *nvram_types_out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 			size_t *size_out, size_t *erase_size_out,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 			bool *protected_out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) int efx_new_mcdi_nvram_test_all(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) int efx_mcdi_nvram_test_all(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) int efx_mcdi_handle_assertion(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) int efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx, const u8 *mac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 				  int *id_out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) int efx_mcdi_wol_filter_reset(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) int efx_mcdi_flush_rxqs(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) void efx_mcdi_mac_start_stats(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) void efx_mcdi_mac_stop_stats(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) void efx_mcdi_mac_pull_stats(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) int efx_mcdi_set_workaround(struct efx_nic *efx, u32 type, bool enabled,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 			    unsigned int *flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) int efx_mcdi_get_workarounds(struct efx_nic *efx, unsigned int *impl_out,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 			     unsigned int *enabled_out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) #ifdef CONFIG_SFC_MCDI_MON
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) int efx_mcdi_mon_probe(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) void efx_mcdi_mon_remove(struct efx_nic *efx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) static inline int efx_mcdi_mon_probe(struct efx_nic *efx) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) static inline void efx_mcdi_mon_remove(struct efx_nic *efx) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) #ifdef CONFIG_SFC_MTD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) int efx_mcdi_mtd_read(struct mtd_info *mtd, loff_t start, size_t len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 		      size_t *retlen, u8 *buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) int efx_mcdi_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) int efx_mcdi_mtd_write(struct mtd_info *mtd, loff_t start, size_t len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 		       size_t *retlen, const u8 *buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) int efx_mcdi_mtd_sync(struct mtd_info *mtd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) void efx_mcdi_mtd_rename(struct efx_mtd_partition *part);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) #endif /* EFX_MCDI_H */