1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2016 - 2018 Cavium Inc.
12 /* Forward declaration */
17 RESERVED_PTT_USER_SPACE,
23 /* @@@TMP - in earlier versions of the emulation, the HW lock started from 1
24 * instead of 0, this should be fixed in later HW versions.
26 #ifndef MISC_REG_DRIVER_CONTROL_0
27 #define MISC_REG_DRIVER_CONTROL_0 MISC_REG_DRIVER_CONTROL_1
29 #ifndef MISC_REG_DRIVER_CONTROL_0_SIZE
30 #define MISC_REG_DRIVER_CONTROL_0_SIZE MISC_REG_DRIVER_CONTROL_1_SIZE
33 /* Definitions for DMA constants */
34 #define DMAE_GO_VALUE 0x1
37 #define DMAE_COMPLETION_VAL 0xAED10000
38 #define DMAE_CMD_ENDIANITY 0x3
40 #define DMAE_COMPLETION_VAL 0xD1AE
41 #define DMAE_CMD_ENDIANITY 0x2
44 #define DMAE_CMD_SIZE 14
45 /* size of DMAE command structure to fill.. DMAE_CMD_SIZE-5 */
46 #define DMAE_CMD_SIZE_TO_FILL (DMAE_CMD_SIZE - 5)
47 /* Minimum wait for dmae opertaion to complete 2 milliseconds */
48 #define DMAE_MIN_WAIT_TIME 0x2
49 #define DMAE_MAX_CLIENTS 32
52 * @brief ecore_gtt_init - Initialize GTT windows
56 void ecore_gtt_init(struct ecore_hwfn *p_hwfn);
59 * @brief ecore_ptt_invalidate - Forces all ptt entries to be re-configured
63 void ecore_ptt_invalidate(struct ecore_hwfn *p_hwfn);
66 * @brief ecore_ptt_pool_alloc - Allocate and initialize PTT pool
70 * @return _ecore_status_t - success (0), negative - error.
72 enum _ecore_status_t ecore_ptt_pool_alloc(struct ecore_hwfn *p_hwfn);
75 * @brief ecore_ptt_pool_free -
79 void ecore_ptt_pool_free(struct ecore_hwfn *p_hwfn);
82 * @brief ecore_ptt_get_bar_addr - Get PPT's external BAR address
88 u32 ecore_ptt_get_bar_addr(struct ecore_ptt *p_ptt);
91 * @brief ecore_ptt_set_win - Set PTT Window's GRC BAR address
97 void ecore_ptt_set_win(struct ecore_hwfn *p_hwfn,
98 struct ecore_ptt *p_ptt,
102 * @brief ecore_get_reserved_ptt - Get a specific reserved PTT
107 * @return struct ecore_ptt *
109 struct ecore_ptt *ecore_get_reserved_ptt(struct ecore_hwfn *p_hwfn,
110 enum reserved_ptts ptt_idx);
113 * @brief ecore_wr - Write value to BAR using the given ptt
120 void ecore_wr(struct ecore_hwfn *p_hwfn,
121 struct ecore_ptt *p_ptt,
126 * @brief ecore_rd - Read value from BAR using the given ptt
132 u32 ecore_rd(struct ecore_hwfn *p_hwfn,
133 struct ecore_ptt *p_ptt,
137 * @brief ecore_memcpy_from - copy n bytes from BAR using the given
146 void ecore_memcpy_from(struct ecore_hwfn *p_hwfn,
147 struct ecore_ptt *p_ptt,
153 * @brief ecore_memcpy_to - copy n bytes to BAR using the given
162 void ecore_memcpy_to(struct ecore_hwfn *p_hwfn,
163 struct ecore_ptt *p_ptt,
168 * @brief ecore_fid_pretend - pretend to another function when
169 * accessing the ptt window. There is no way to unpretend
170 * a function. The only way to cancel a pretend is to
171 * pretend back to the original function.
175 * @param fid - fid field of pxp_pretend structure. Can contain
176 * either pf / vf, port/path fields are don't care.
178 void ecore_fid_pretend(struct ecore_hwfn *p_hwfn,
179 struct ecore_ptt *p_ptt,
183 * @brief ecore_port_pretend - pretend to another port when
184 * accessing the ptt window
188 * @param port_id - the port to pretend to
190 void ecore_port_pretend(struct ecore_hwfn *p_hwfn,
191 struct ecore_ptt *p_ptt,
195 * @brief ecore_port_unpretend - cancel any previously set port
201 void ecore_port_unpretend(struct ecore_hwfn *p_hwfn,
202 struct ecore_ptt *p_ptt);
205 * @brief ecore_port_fid_pretend - pretend to another port and another function
206 * when accessing the ptt window
210 * @param port_id - the port to pretend to
211 * @param fid - fid field of pxp_pretend structure. Can contain either pf / vf.
213 void ecore_port_fid_pretend(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
214 u8 port_id, u16 fid);
217 * @brief ecore_vfid_to_concrete - build a concrete FID for a
224 u32 ecore_vfid_to_concrete(struct ecore_hwfn *p_hwfn, u8 vfid);
227 * @brief ecore_dmae_info_alloc - Init the dmae_info structure
228 * which is part of p_hwfn.
231 enum _ecore_status_t ecore_dmae_info_alloc(struct ecore_hwfn *p_hwfn);
234 * @brief ecore_dmae_info_free - Free the dmae_info structure
235 * which is part of p_hwfn
239 void ecore_dmae_info_free(struct ecore_hwfn *p_hwfn);
242 * @brief ecore_dmae_host2grc - copy data from source address to
243 * dmae registers using the given ptt
248 * @param grc_addr (dmae_data_offset)
249 * @param size_in_dwords
250 * @param p_params (default parameters will be used in case of OSAL_NULL)
252 * @return enum _ecore_status_t
255 ecore_dmae_host2grc(struct ecore_hwfn *p_hwfn,
256 struct ecore_ptt *p_ptt,
260 struct dmae_params *p_params);
263 * @brief ecore_dmae_grc2host - Read data from dmae data offset
264 * to source address using the given ptt
267 * @param grc_addr (dmae_data_offset)
269 * @param size_in_dwords
270 * @param p_params (default parameters will be used in case of OSAL_NULL)
272 * @return enum _ecore_status_t
275 ecore_dmae_grc2host(struct ecore_hwfn *p_hwfn,
276 struct ecore_ptt *p_ptt,
278 dma_addr_t dest_addr,
280 struct dmae_params *p_params);
283 * @brief ecore_dmae_host2host - copy data from to source address
284 * to a destination address (for SRIOV) using the given ptt
290 * @param size_in_dwords
291 * @param p_params (default parameters will be used in case of OSAL_NULL)
293 * @return enum _ecore_status_t
296 ecore_dmae_host2host(struct ecore_hwfn *p_hwfn,
297 struct ecore_ptt *p_ptt,
298 dma_addr_t source_addr,
299 dma_addr_t dest_addr,
301 struct dmae_params *p_params);
303 enum _ecore_status_t ecore_dmae_sanity(struct ecore_hwfn *p_hwfn,
304 struct ecore_ptt *p_ptt,
307 enum _ecore_status_t ecore_init_fw_data(struct ecore_dev *p_dev,
310 void ecore_hw_err_notify(struct ecore_hwfn *p_hwfn,
311 enum ecore_hw_err_type err_type);
314 * @brief ecore_ppfid_wr - Write value to BAR using the given ptt while
315 * pretending to a PF to which the given PPFID pertains.
323 void ecore_ppfid_wr(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
324 u8 abs_ppfid, u32 hw_addr, u32 val);
327 * @brief ecore_ppfid_rd - Read value from BAR using the given ptt while
328 * pretending to a PF to which the given PPFID pertains.
335 u32 ecore_ppfid_rd(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
336 u8 abs_ppfid, u32 hw_addr);
338 #endif /* __ECORE_HW_H__ */