1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2016 - 2018 Cavium Inc.
11 #include "ecore_dev_api.h"
13 /* Forward decleration */
18 RESERVED_PTT_USER_SPACE,
24 /* @@@TMP - in earlier versions of the emulation, the HW lock started from 1
25 * instead of 0, this should be fixed in later HW versions.
27 #ifndef MISC_REG_DRIVER_CONTROL_0
28 #define MISC_REG_DRIVER_CONTROL_0 MISC_REG_DRIVER_CONTROL_1
30 #ifndef MISC_REG_DRIVER_CONTROL_0_SIZE
31 #define MISC_REG_DRIVER_CONTROL_0_SIZE MISC_REG_DRIVER_CONTROL_1_SIZE
34 enum _dmae_cmd_dst_mask {
35 DMAE_CMD_DST_MASK_NONE = 0,
36 DMAE_CMD_DST_MASK_PCIE = 1,
37 DMAE_CMD_DST_MASK_GRC = 2
40 enum _dmae_cmd_src_mask {
41 DMAE_CMD_SRC_MASK_PCIE = 0,
42 DMAE_CMD_SRC_MASK_GRC = 1
45 enum _dmae_cmd_crc_mask {
46 DMAE_CMD_COMP_CRC_EN_MASK_NONE = 0,
47 DMAE_CMD_COMP_CRC_EN_MASK_SET = 1
50 /* definitions for DMA constants */
51 #define DMAE_GO_VALUE 0x1
54 #define DMAE_COMPLETION_VAL 0xAED10000
55 #define DMAE_CMD_ENDIANITY 0x3
57 #define DMAE_COMPLETION_VAL 0xD1AE
58 #define DMAE_CMD_ENDIANITY 0x2
61 #define DMAE_CMD_SIZE 14
62 /* size of DMAE command structure to fill.. DMAE_CMD_SIZE-5 */
63 #define DMAE_CMD_SIZE_TO_FILL (DMAE_CMD_SIZE - 5)
64 /* Minimum wait for dmae opertaion to complete 2 milliseconds */
65 #define DMAE_MIN_WAIT_TIME 0x2
66 #define DMAE_MAX_CLIENTS 32
69 * @brief ecore_gtt_init - Initialize GTT windows
74 void ecore_gtt_init(struct ecore_hwfn *p_hwfn,
75 struct ecore_ptt *p_ptt);
78 * @brief ecore_ptt_invalidate - Forces all ptt entries to be re-configured
82 void ecore_ptt_invalidate(struct ecore_hwfn *p_hwfn);
85 * @brief ecore_ptt_pool_alloc - Allocate and initialize PTT pool
89 * @return _ecore_status_t - success (0), negative - error.
91 enum _ecore_status_t ecore_ptt_pool_alloc(struct ecore_hwfn *p_hwfn);
94 * @brief ecore_ptt_pool_free -
98 void ecore_ptt_pool_free(struct ecore_hwfn *p_hwfn);
101 * @brief ecore_ptt_get_bar_addr - Get PPT's external BAR address
108 u32 ecore_ptt_get_bar_addr(struct ecore_ptt *p_ptt);
111 * @brief ecore_ptt_set_win - Set PTT Window's GRC BAR address
117 void ecore_ptt_set_win(struct ecore_hwfn *p_hwfn,
118 struct ecore_ptt *p_ptt,
122 * @brief ecore_get_reserved_ptt - Get a specific reserved PTT
127 * @return struct ecore_ptt *
129 struct ecore_ptt *ecore_get_reserved_ptt(struct ecore_hwfn *p_hwfn,
130 enum reserved_ptts ptt_idx);
133 * @brief ecore_wr - Write value to BAR using the given ptt
140 void ecore_wr(struct ecore_hwfn *p_hwfn,
141 struct ecore_ptt *p_ptt,
146 * @brief ecore_rd - Read value from BAR using the given ptt
153 u32 ecore_rd(struct ecore_hwfn *p_hwfn,
154 struct ecore_ptt *p_ptt,
158 * @brief ecore_memcpy_from - copy n bytes from BAR using the given
167 void ecore_memcpy_from(struct ecore_hwfn *p_hwfn,
168 struct ecore_ptt *p_ptt,
174 * @brief ecore_memcpy_to - copy n bytes to BAR using the given
183 void ecore_memcpy_to(struct ecore_hwfn *p_hwfn,
184 struct ecore_ptt *p_ptt,
189 * @brief ecore_fid_pretend - pretend to another function when
190 * accessing the ptt window. There is no way to unpretend
191 * a function. The only way to cancel a pretend is to
192 * pretend back to the original function.
196 * @param fid - fid field of pxp_pretend structure. Can contain
197 * either pf / vf, port/path fields are don't care.
199 void ecore_fid_pretend(struct ecore_hwfn *p_hwfn,
200 struct ecore_ptt *p_ptt,
204 * @brief ecore_port_pretend - pretend to another port when
205 * accessing the ptt window
209 * @param port_id - the port to pretend to
211 void ecore_port_pretend(struct ecore_hwfn *p_hwfn,
212 struct ecore_ptt *p_ptt,
216 * @brief ecore_port_unpretend - cancel any previously set port
222 void ecore_port_unpretend(struct ecore_hwfn *p_hwfn,
223 struct ecore_ptt *p_ptt);
226 * @brief ecore_vfid_to_concrete - build a concrete FID for a
233 u32 ecore_vfid_to_concrete(struct ecore_hwfn *p_hwfn, u8 vfid);
236 * @brief ecore_dmae_info_alloc - Init the dmae_info structure
237 * which is part of p_hwfn.
240 enum _ecore_status_t ecore_dmae_info_alloc(struct ecore_hwfn *p_hwfn);
243 * @brief ecore_dmae_info_free - Free the dmae_info structure
244 * which is part of p_hwfn
248 void ecore_dmae_info_free(struct ecore_hwfn *p_hwfn);
250 enum _ecore_status_t ecore_init_fw_data(struct ecore_dev *p_dev,
253 void ecore_hw_err_notify(struct ecore_hwfn *p_hwfn,
254 enum ecore_hw_err_type err_type);
256 enum _ecore_status_t ecore_dmae_sanity(struct ecore_hwfn *p_hwfn,
257 struct ecore_ptt *p_ptt,
260 #endif /* __ECORE_HW_H__ */