2 * Copyright (c) 2016 QLogic Corporation.
6 * See LICENSE.qede_pmd for copyright and licensing details.
10 #define __ECORE_HW_H__
13 #include "ecore_dev_api.h"
15 /* Forward decleration */
20 RESERVED_PTT_USER_SPACE,
26 /* @@@TMP - in earlier versions of the emulation, the HW lock started from 1
27 * instead of 0, this should be fixed in later HW versions.
29 #ifndef MISC_REG_DRIVER_CONTROL_0
30 #define MISC_REG_DRIVER_CONTROL_0 MISC_REG_DRIVER_CONTROL_1
32 #ifndef MISC_REG_DRIVER_CONTROL_0_SIZE
33 #define MISC_REG_DRIVER_CONTROL_0_SIZE MISC_REG_DRIVER_CONTROL_1_SIZE
36 enum _dmae_cmd_dst_mask {
37 DMAE_CMD_DST_MASK_NONE = 0,
38 DMAE_CMD_DST_MASK_PCIE = 1,
39 DMAE_CMD_DST_MASK_GRC = 2
42 enum _dmae_cmd_src_mask {
43 DMAE_CMD_SRC_MASK_PCIE = 0,
44 DMAE_CMD_SRC_MASK_GRC = 1
47 enum _dmae_cmd_crc_mask {
48 DMAE_CMD_COMP_CRC_EN_MASK_NONE = 0,
49 DMAE_CMD_COMP_CRC_EN_MASK_SET = 1
52 /* definitions for DMA constants */
53 #define DMAE_GO_VALUE 0x1
56 #define DMAE_COMPLETION_VAL 0xAED10000
57 #define DMAE_CMD_ENDIANITY 0x3
59 #define DMAE_COMPLETION_VAL 0xD1AE
60 #define DMAE_CMD_ENDIANITY 0x2
63 #define DMAE_CMD_SIZE 14
64 /* size of DMAE command structure to fill.. DMAE_CMD_SIZE-5 */
65 #define DMAE_CMD_SIZE_TO_FILL (DMAE_CMD_SIZE - 5)
66 /* Minimum wait for dmae opertaion to complete 2 milliseconds */
67 #define DMAE_MIN_WAIT_TIME 0x2
68 #define DMAE_MAX_CLIENTS 32
71 * @brief ecore_gtt_init - Initialize GTT windows
76 void ecore_gtt_init(struct ecore_hwfn *p_hwfn,
77 struct ecore_ptt *p_ptt);
80 * @brief ecore_ptt_invalidate - Forces all ptt entries to be re-configured
84 void ecore_ptt_invalidate(struct ecore_hwfn *p_hwfn);
87 * @brief ecore_ptt_pool_alloc - Allocate and initialize PTT pool
91 * @return _ecore_status_t - success (0), negative - error.
93 enum _ecore_status_t ecore_ptt_pool_alloc(struct ecore_hwfn *p_hwfn);
96 * @brief ecore_ptt_pool_free -
100 void ecore_ptt_pool_free(struct ecore_hwfn *p_hwfn);
103 * @brief ecore_ptt_get_bar_addr - Get PPT's external BAR address
110 u32 ecore_ptt_get_bar_addr(struct ecore_ptt *p_ptt);
113 * @brief ecore_ptt_set_win - Set PTT Window's GRC BAR address
119 void ecore_ptt_set_win(struct ecore_hwfn *p_hwfn,
120 struct ecore_ptt *p_ptt,
124 * @brief ecore_get_reserved_ptt - Get a specific reserved PTT
129 * @return struct ecore_ptt *
131 struct ecore_ptt *ecore_get_reserved_ptt(struct ecore_hwfn *p_hwfn,
132 enum reserved_ptts ptt_idx);
135 * @brief ecore_wr - Write value to BAR using the given ptt
142 void ecore_wr(struct ecore_hwfn *p_hwfn,
143 struct ecore_ptt *p_ptt,
148 * @brief ecore_rd - Read value from BAR using the given ptt
155 u32 ecore_rd(struct ecore_hwfn *p_hwfn,
156 struct ecore_ptt *p_ptt,
160 * @brief ecore_memcpy_from - copy n bytes from BAR using the given
169 void ecore_memcpy_from(struct ecore_hwfn *p_hwfn,
170 struct ecore_ptt *p_ptt,
176 * @brief ecore_memcpy_to - copy n bytes to BAR using the given
185 void ecore_memcpy_to(struct ecore_hwfn *p_hwfn,
186 struct ecore_ptt *p_ptt,
191 * @brief ecore_fid_pretend - pretend to another function when
192 * accessing the ptt window. There is no way to unpretend
193 * a function. The only way to cancel a pretend is to
194 * pretend back to the original function.
198 * @param fid - fid field of pxp_pretend structure. Can contain
199 * either pf / vf, port/path fields are don't care.
201 void ecore_fid_pretend(struct ecore_hwfn *p_hwfn,
202 struct ecore_ptt *p_ptt,
206 * @brief ecore_port_pretend - pretend to another port when
207 * accessing the ptt window
211 * @param port_id - the port to pretend to
213 void ecore_port_pretend(struct ecore_hwfn *p_hwfn,
214 struct ecore_ptt *p_ptt,
218 * @brief ecore_port_unpretend - cancel any previously set port
224 void ecore_port_unpretend(struct ecore_hwfn *p_hwfn,
225 struct ecore_ptt *p_ptt);
228 * @brief ecore_vfid_to_concrete - build a concrete FID for a
235 u32 ecore_vfid_to_concrete(struct ecore_hwfn *p_hwfn, u8 vfid);
238 * @brief ecore_dmae_info_alloc - Init the dmae_info structure
239 * which is part of p_hwfn.
242 enum _ecore_status_t ecore_dmae_info_alloc(struct ecore_hwfn *p_hwfn);
245 * @brief ecore_dmae_info_free - Free the dmae_info structure
246 * which is part of p_hwfn
250 void ecore_dmae_info_free(struct ecore_hwfn *p_hwfn);
252 enum _ecore_status_t ecore_init_fw_data(struct ecore_dev *p_dev,
255 void ecore_hw_err_notify(struct ecore_hwfn *p_hwfn,
256 enum ecore_hw_err_type err_type);
258 #endif /* __ECORE_HW_H__ */