xref: /freebsd/sys/dev/qlnx/qlnxe/ecore_mcp.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1 /*
2  * Copyright (c) 2017-2018 Cavium, Inc.
3  * All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions
7  *  are met:
8  *
9  *  1. Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  *  2. Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  *
15  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  *  POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #ifndef __ECORE_MCP_H__
30 #define __ECORE_MCP_H__
31 
32 #include "bcm_osal.h"
33 #include "mcp_public.h"
34 #include "ecore.h"
35 #include "ecore_mcp_api.h"
36 #include "ecore_dev_api.h"
37 
38 /* Using hwfn number (and not pf_num) is required since in CMT mode,
39  * same pf_num may be used by two different hwfn
40  * TODO - this shouldn't really be in .h file, but until all fields
41  * required during hw-init will be placed in their correct place in shmem
42  * we need it in ecore_dev.c [for readin the nvram reflection in shmem].
43  */
44 #define MCP_PF_ID_BY_REL(p_hwfn, rel_pfid) (ECORE_IS_BB((p_hwfn)->p_dev) ? \
45 					    ((rel_pfid) | \
46 					     ((p_hwfn)->abs_pf_id & 1) << 3) : \
47 					     rel_pfid)
48 #define MCP_PF_ID(p_hwfn)	MCP_PF_ID_BY_REL(p_hwfn, (p_hwfn)->rel_pf_id)
49 
50 struct ecore_mcp_info {
51 	/* List for mailbox commands which were sent and wait for a response */
52 	osal_list_t cmd_list;
53 
54 	/* Spinlock used for protecting the access to the mailbox commands list
55 	 * and the sending of the commands.
56 	 */
57 	osal_spinlock_t cmd_lock;
58 
59 	/* Flag to indicate whether sending a MFW mailbox command is blocked */
60 	bool b_block_cmd;
61 
62 	/* Spinlock used for syncing SW link-changes and link-changes
63 	 * originating from attention context.
64 	 */
65 	osal_spinlock_t link_lock;
66 
67 	/* Address of the MCP public area */
68 	u32 public_base;
69 	/* Address of the driver mailbox */
70 	u32 drv_mb_addr;
71 	/* Address of the MFW mailbox */
72 	u32 mfw_mb_addr;
73 	/* Address of the port configuration (link) */
74 	u32 port_addr;
75 
76 	/* Current driver mailbox sequence */
77 	u16 drv_mb_seq;
78 	/* Current driver pulse sequence */
79 	u16 drv_pulse_seq;
80 
81 	struct ecore_mcp_link_params       link_input;
82 	struct ecore_mcp_link_state	   link_output;
83 	struct ecore_mcp_link_capabilities link_capabilities;
84 
85 	struct ecore_mcp_function_info	   func_info;
86 
87 	u8 *mfw_mb_cur;
88 	u8 *mfw_mb_shadow;
89 	u16 mfw_mb_length;
90 	u32 mcp_hist;
91 
92 	/* Capabilties negotiated with the MFW */
93 	u32 capabilities;
94 };
95 
96 struct ecore_mcp_mb_params {
97 	u32 cmd;
98 	u32 param;
99 	void *p_data_src;
100 	void *p_data_dst;
101 	u32 mcp_resp;
102 	u32 mcp_param;
103 	u8 data_src_size;
104 	u8 data_dst_size;
105 	u32 flags;
106 #define ECORE_MB_FLAG_CAN_SLEEP		(0x1 << 0)
107 #define ECORE_MB_FLAG_AVOID_BLOCK	(0x1 << 1)
108 #define ECORE_MB_FLAGS_IS_SET(params, flag)	\
109 	((params) != OSAL_NULL && ((params)->flags & ECORE_MB_FLAG_##flag))
110 };
111 
112 enum ecore_ov_eswitch {
113 	ECORE_OV_ESWITCH_NONE,
114 	ECORE_OV_ESWITCH_VEB,
115 	ECORE_OV_ESWITCH_VEPA
116 };
117 
118 struct ecore_drv_tlv_hdr {
119 	u8 tlv_type;	/* According to the enum below */
120 	u8 tlv_length;	/* In dwords - not including this header */
121 	u8 tlv_reserved;
122 #define ECORE_DRV_TLV_FLAGS_CHANGED 0x01
123 	u8 tlv_flags;
124 };
125 
126 /**
127  * @brief Initialize the interface with the MCP
128  *
129  * @param p_hwfn - HW func
130  * @param p_ptt - PTT required for register access
131  *
132  * @return enum _ecore_status_t
133  */
134 enum _ecore_status_t ecore_mcp_cmd_init(struct ecore_hwfn *p_hwfn,
135 					struct ecore_ptt *p_ptt);
136 
137 /**
138  * @brief Initialize the port interface with the MCP
139  *
140  * @param p_hwfn
141  * @param p_ptt
142  * Can only be called after `num_ports_in_engine' is set
143  */
144 void ecore_mcp_cmd_port_init(struct ecore_hwfn *p_hwfn,
145 			     struct ecore_ptt *p_ptt);
146 /**
147  * @brief Releases resources allocated during the init process.
148  *
149  * @param p_hwfn - HW func
150  * @param p_ptt - PTT required for register access
151  *
152  * @return enum _ecore_status_t
153  */
154 
155 enum _ecore_status_t ecore_mcp_free(struct ecore_hwfn *p_hwfn);
156 
157 /**
158  * @brief This function is called from the DPC context. After
159  * pointing PTT to the mfw mb, check for events sent by the MCP
160  * to the driver and ack them. In case a critical event
161  * detected, it will be handled here, otherwise the work will be
162  * queued to a sleepable work-queue.
163  *
164  * @param p_hwfn - HW function
165  * @param p_ptt - PTT required for register access
166  * @return enum _ecore_status_t - ECORE_SUCCESS - operation
167  * was successul.
168  */
169 enum _ecore_status_t ecore_mcp_handle_events(struct ecore_hwfn *p_hwfn,
170 					     struct ecore_ptt *p_ptt);
171 
172 /**
173  * @brief When MFW doesn't get driver pulse for couple of seconds, at some
174  * threshold before timeout expires, it will generate interrupt
175  * through a dedicated status block (DPSB - Driver Pulse Status
176  * Block), which the driver should respond immediately, by
177  * providing keepalive indication after setting the PTT to the
178  * driver-MFW mailbox. This function is called directly from the
179  * DPC upon receiving the DPSB attention.
180  *
181  * @param p_hwfn - hw function
182  * @param p_ptt - PTT required for register access
183  * @return enum _ecore_status_t - ECORE_SUCCESS - operation
184  * was successful.
185  */
186 enum _ecore_status_t ecore_issue_pulse(struct ecore_hwfn *p_hwfn,
187 				       struct ecore_ptt *p_ptt);
188 
189 enum ecore_drv_role {
190 	ECORE_DRV_ROLE_OS,
191 	ECORE_DRV_ROLE_KDUMP,
192 };
193 
194 struct ecore_load_req_params {
195 	/* Input params */
196 	enum ecore_drv_role drv_role;
197 	u8 timeout_val; /* 1..254, '0' - default value, '255' - no timeout */
198 	bool avoid_eng_reset;
199 	enum ecore_override_force_load override_force_load;
200 
201 	/* Output params */
202 	u32 load_code;
203 };
204 
205 /**
206  * @brief Sends a LOAD_REQ to the MFW, and in case the operation succeeds,
207  *        returns whether this PF is the first on the engine/port or function.
208  *
209  * @param p_hwfn
210  * @param p_ptt
211  * @param p_params
212  *
213  * @return enum _ecore_status_t - ECORE_SUCCESS - Operation was successful.
214  */
215 enum _ecore_status_t ecore_mcp_load_req(struct ecore_hwfn *p_hwfn,
216 					struct ecore_ptt *p_ptt,
217 					struct ecore_load_req_params *p_params);
218 
219 /**
220  * @brief Sends a LOAD_DONE message to the MFW
221  *
222  * @param p_hwfn
223  * @param p_ptt
224  *
225  * @return enum _ecore_status_t - ECORE_SUCCESS - Operation was successful.
226  */
227 enum _ecore_status_t ecore_mcp_load_done(struct ecore_hwfn *p_hwfn,
228 					 struct ecore_ptt *p_ptt);
229 
230 /**
231  * @brief Sends a CANCEL_LOAD_REQ message to the MFW
232  *
233  * @param p_hwfn
234  * @param p_ptt
235  *
236  * @return enum _ecore_status_t - ECORE_SUCCESS - Operation was successful.
237  */
238 enum _ecore_status_t ecore_mcp_cancel_load_req(struct ecore_hwfn *p_hwfn,
239 					       struct ecore_ptt *p_ptt);
240 
241 /**
242  * @brief Sends a UNLOAD_REQ message to the MFW
243  *
244  * @param p_hwfn
245  * @param p_ptt
246  *
247  * @return enum _ecore_status_t - ECORE_SUCCESS - Operation was successful.
248  */
249 enum _ecore_status_t ecore_mcp_unload_req(struct ecore_hwfn *p_hwfn,
250 					  struct ecore_ptt *p_ptt);
251 
252 /**
253  * @brief Sends a UNLOAD_DONE message to the MFW
254  *
255  * @param p_hwfn
256  * @param p_ptt
257  *
258  * @return enum _ecore_status_t - ECORE_SUCCESS - Operation was successful.
259  */
260 enum _ecore_status_t ecore_mcp_unload_done(struct ecore_hwfn *p_hwfn,
261 					   struct ecore_ptt *p_ptt);
262 
263 /**
264  * @brief Read the MFW mailbox into Current buffer.
265  *
266  * @param p_hwfn
267  * @param p_ptt
268  */
269 void ecore_mcp_read_mb(struct ecore_hwfn *p_hwfn,
270 		       struct ecore_ptt *p_ptt);
271 
272 /**
273  * @brief Ack to mfw that driver finished FLR process for VFs
274  *
275  * @param p_hwfn
276  * @param p_ptt
277  * @param vfs_to_ack - bit mask of all engine VFs for which the PF acks.
278  *
279  * @param return enum _ecore_status_t - ECORE_SUCCESS upon success.
280  */
281 enum _ecore_status_t ecore_mcp_ack_vf_flr(struct ecore_hwfn *p_hwfn,
282 					  struct ecore_ptt *p_ptt,
283 					  u32 *vfs_to_ack);
284 
285 /**
286  * @brief - calls during init to read shmem of all function-related info.
287  *
288  * @param p_hwfn
289  *
290  * @param return ECORE_SUCCESS upon success.
291  */
292 enum _ecore_status_t ecore_mcp_fill_shmem_func_info(struct ecore_hwfn *p_hwfn,
293 						    struct ecore_ptt *p_ptt);
294 
295 /**
296  * @brief - Reset the MCP using mailbox command.
297  *
298  * @param p_hwfn
299  * @param p_ptt
300  *
301  * @param return ECORE_SUCCESS upon success.
302  */
303 enum _ecore_status_t ecore_mcp_reset(struct ecore_hwfn *p_hwfn,
304 				     struct ecore_ptt *p_ptt);
305 
306 /**
307  * @brief indicates whether the MFW objects [under mcp_info] are accessible
308  *
309  * @param p_hwfn
310  *
311  * @return true iff MFW is running and mcp_info is initialized
312  */
313 bool ecore_mcp_is_init(struct ecore_hwfn *p_hwfn);
314 
315 /**
316  * @brief request MFW to configure MSI-X for a VF
317  *
318  * @param p_hwfn
319  * @param p_ptt
320  * @param vf_id - absolute inside engine
321  * @param num_sbs - number of entries to request
322  *
323  * @return enum _ecore_status_t
324  */
325 enum _ecore_status_t ecore_mcp_config_vf_msix(struct ecore_hwfn *p_hwfn,
326 					      struct ecore_ptt *p_ptt,
327 					      u8 vf_id, u8 num);
328 
329 /**
330  * @brief - Halt the MCP.
331  *
332  * @param p_hwfn
333  * @param p_ptt
334  *
335  * @param return ECORE_SUCCESS upon success.
336  */
337 enum _ecore_status_t ecore_mcp_halt(struct ecore_hwfn *p_hwfn,
338 				    struct ecore_ptt *p_ptt);
339 
340 /**
341  * @brief - Wake up the MCP.
342  *
343  * @param p_hwfn
344  * @param p_ptt
345  *
346  * @param return ECORE_SUCCESS upon success.
347  */
348 enum _ecore_status_t ecore_mcp_resume(struct ecore_hwfn *p_hwfn,
349 				      struct ecore_ptt *p_ptt);
350 int __ecore_configure_pf_max_bandwidth(struct ecore_hwfn *p_hwfn,
351 				       struct ecore_ptt *p_ptt,
352 				       struct ecore_mcp_link_state *p_link,
353 				       u8 max_bw);
354 int __ecore_configure_pf_min_bandwidth(struct ecore_hwfn *p_hwfn,
355 				       struct ecore_ptt *p_ptt,
356 				       struct ecore_mcp_link_state *p_link,
357 				       u8 min_bw);
358 enum _ecore_status_t ecore_mcp_mask_parities(struct ecore_hwfn *p_hwfn,
359 					     struct ecore_ptt *p_ptt,
360 					     u32 mask_parities);
361 #if 0
362 enum _ecore_status_t ecore_hw_init_first_eth(struct ecore_hwfn *p_hwfn,
363 					     struct ecore_ptt *p_ptt,
364 					     u8 *p_pf);
365 #endif
366 
367 /**
368  * @brief - Sends crash mdump related info to the MFW.
369  *
370  * @param p_hwfn
371  * @param p_ptt
372  * @param epoch
373  *
374  * @param return ECORE_SUCCESS upon success.
375  */
376 enum _ecore_status_t ecore_mcp_mdump_set_values(struct ecore_hwfn *p_hwfn,
377 						struct ecore_ptt *p_ptt,
378 						u32 epoch);
379 
380 /**
381  * @brief - Triggers a MFW crash dump procedure.
382  *
383  * @param p_hwfn
384  * @param p_ptt
385  *
386  * @param return ECORE_SUCCESS upon success.
387  */
388 enum _ecore_status_t ecore_mcp_mdump_trigger(struct ecore_hwfn *p_hwfn,
389 					     struct ecore_ptt *p_ptt);
390 
391 struct ecore_mdump_retain_data {
392 	u32 valid;
393 	u32 epoch;
394 	u32 pf;
395 	u32 status;
396 };
397 
398 /**
399  * @brief - Gets the mdump retained data from the MFW.
400  *
401  * @param p_hwfn
402  * @param p_ptt
403  * @param p_mdump_retain
404  *
405  * @param return ECORE_SUCCESS upon success.
406  */
407 enum _ecore_status_t
408 ecore_mcp_mdump_get_retain(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
409 			   struct ecore_mdump_retain_data *p_mdump_retain);
410 
411 /**
412  * @brief - Sets the MFW's max value for the given resource
413  *
414  *  @param p_hwfn
415  *  @param p_ptt
416  *  @param res_id
417  *  @param resc_max_val
418  *  @param p_mcp_resp
419  *
420  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
421  */
422 enum _ecore_status_t
423 ecore_mcp_set_resc_max_val(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
424 			   enum ecore_resources res_id, u32 resc_max_val,
425 			   u32 *p_mcp_resp);
426 
427 /**
428  * @brief - Gets the MFW allocation info for the given resource
429  *
430  *  @param p_hwfn
431  *  @param p_ptt
432  *  @param res_id
433  *  @param p_mcp_resp
434  *  @param p_resc_num
435  *  @param p_resc_start
436  *
437  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
438  */
439 enum _ecore_status_t
440 ecore_mcp_get_resc_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
441 			enum ecore_resources res_id, u32 *p_mcp_resp,
442 			u32 *p_resc_num, u32 *p_resc_start);
443 
444 /**
445  * @brief - Initiates PF FLR
446  *
447  *  @param p_hwfn
448  *  @param p_ptt
449  *
450  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
451  */
452 enum _ecore_status_t ecore_mcp_initiate_pf_flr(struct ecore_hwfn *p_hwfn,
453 					       struct ecore_ptt *p_ptt);
454 
455 /**
456  * @brief Send eswitch mode to MFW
457  *
458  *  @param p_hwfn
459  *  @param p_ptt
460  *  @param eswitch - eswitch mode
461  *
462  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
463  */
464 enum _ecore_status_t
465 ecore_mcp_ov_update_eswitch(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
466 			    enum ecore_ov_eswitch eswitch);
467 
468 #define ECORE_MCP_RESC_LOCK_MIN_VAL	RESOURCE_DUMP /* 0 */
469 #define ECORE_MCP_RESC_LOCK_MAX_VAL	31
470 
471 enum ecore_resc_lock {
472 	ECORE_RESC_LOCK_DBG_DUMP = ECORE_MCP_RESC_LOCK_MIN_VAL,
473 	/* Locks that the MFW is aware of should be added here downwards */
474 
475 	/* Ecore only locks should be added here upwards */
476 	ECORE_RESC_LOCK_IND_TABLE = 26,
477 	ECORE_RESC_LOCK_PTP_PORT0 = 27,
478 	ECORE_RESC_LOCK_PTP_PORT1 = 28,
479 	ECORE_RESC_LOCK_PTP_PORT2 = 29,
480 	ECORE_RESC_LOCK_PTP_PORT3 = 30,
481 	ECORE_RESC_LOCK_RESC_ALLOC = ECORE_MCP_RESC_LOCK_MAX_VAL,
482 
483 	/* A dummy value to be used for auxillary functions in need of
484 	 * returning an 'error' value.
485 	 */
486 	ECORE_RESC_LOCK_RESC_INVALID,
487 };
488 
489 struct ecore_resc_lock_params {
490 	/* Resource number [valid values are 0..31] */
491 	u8 resource;
492 
493 	/* Lock timeout value in seconds [default, none or 1..254] */
494 	u8 timeout;
495 #define ECORE_MCP_RESC_LOCK_TO_DEFAULT	0
496 #define ECORE_MCP_RESC_LOCK_TO_NONE	255
497 
498 	/* Number of times to retry locking */
499 	u8 retry_num;
500 #define ECORE_MCP_RESC_LOCK_RETRY_CNT_DFLT	10
501 
502 	/* The interval in usec between retries */
503 	u32 retry_interval;
504 #define ECORE_MCP_RESC_LOCK_RETRY_VAL_DFLT	10000
505 
506 	/* Use sleep or delay between retries */
507 	bool sleep_b4_retry;
508 
509 	/* Will be set as true if the resource is free and granted */
510 	bool b_granted;
511 
512 	/* Will be filled with the resource owner.
513 	 * [0..15 = PF0-15, 16 = MFW, 17 = diag over serial]
514 	 */
515 	u8 owner;
516 };
517 
518 /**
519  * @brief Acquires MFW generic resource lock
520  *
521  *  @param p_hwfn
522  *  @param p_ptt
523  *  @param p_params
524  *
525  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
526  */
527 enum _ecore_status_t
528 ecore_mcp_resc_lock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
529 		    struct ecore_resc_lock_params *p_params);
530 
531 struct ecore_resc_unlock_params {
532 	/* Resource number [valid values are 0..31] */
533 	u8 resource;
534 
535 	/* Allow to release a resource even if belongs to another PF */
536 	bool b_force;
537 
538 	/* Will be set as true if the resource is released */
539 	bool b_released;
540 };
541 
542 /**
543  * @brief Releases MFW generic resource lock
544  *
545  *  @param p_hwfn
546  *  @param p_ptt
547  *  @param p_params
548  *
549  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
550  */
551 enum _ecore_status_t
552 ecore_mcp_resc_unlock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
553 		      struct ecore_resc_unlock_params *p_params);
554 
555 /**
556  * @brief - default initialization for lock/unlock resource structs
557  *
558  * @param p_lock - lock params struct to be initialized; Can be OSAL_NULL
559  * @param p_unlock - unlock params struct to be initialized; Can be OSAL_NULL
560  * @param resource - the requested resource
561  * @paral b_is_permanent - disable retries & aging when set
562  */
563 void ecore_mcp_resc_lock_default_init(struct ecore_resc_lock_params *p_lock,
564 				      struct ecore_resc_unlock_params *p_unlock,
565 				      enum ecore_resc_lock resource,
566 				      bool b_is_permanent);
567 
568 void ecore_mcp_wol_wr(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
569 		      u32 offset, u32 val);
570 
571 /**
572  * @brief Learn of supported MFW features; To be done during early init
573  *
574  * @param p_hwfn
575  * @param p_ptt
576  */
577 enum _ecore_status_t ecore_mcp_get_capabilities(struct ecore_hwfn *p_hwfn,
578 						struct ecore_ptt *p_ptt);
579 
580 /**
581  * @brief Inform MFW of set of features supported by driver. Should be done
582  * inside the contet of the LOAD_REQ.
583  *
584  * @param p_hwfn
585  * @param p_ptt
586  */
587 enum _ecore_status_t ecore_mcp_set_capabilities(struct ecore_hwfn *p_hwfn,
588 						struct ecore_ptt *p_ptt);
589 
590 /**
591  * @brief Initialize MFW mailbox and sequence values for driver interaction.
592  *
593  * @param p_hwfn
594  * @param p_ptt
595  */
596 enum _ecore_status_t ecore_load_mcp_offsets(struct ecore_hwfn *p_hwfn,
597 					    struct ecore_ptt *p_ptt);
598 
599 enum ecore_mcp_drv_attr_cmd {
600 	ECORE_MCP_DRV_ATTR_CMD_READ,
601 	ECORE_MCP_DRV_ATTR_CMD_WRITE,
602 	ECORE_MCP_DRV_ATTR_CMD_READ_CLEAR,
603 	ECORE_MCP_DRV_ATTR_CMD_CLEAR,
604 };
605 
606 struct ecore_mcp_drv_attr {
607 	enum ecore_mcp_drv_attr_cmd attr_cmd;
608 	u32 attr_num;
609 
610 	/* R/RC - will be set with the read value
611 	 * W - should hold the required value to be written
612 	 * C - DC
613 	 */
614 	u32 val;
615 
616 	/* W - mask/offset to be applied on the given value
617 	 * R/RC/C - DC
618 	 */
619 	u32 mask;
620 	u32 offset;
621 };
622 
623 /**
624  * @brief Handle the drivers' attributes that are kept by the MFW.
625  *
626  * @param p_hwfn
627  * @param p_ptt
628  * @param p_drv_attr
629  */
630 enum _ecore_status_t
631 ecore_mcp_drv_attribute(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
632 			struct ecore_mcp_drv_attr *p_drv_attr);
633 
634 /**
635  * @brief Read ufp config from the shared memory.
636  *
637  * @param p_hwfn
638  * @param p_ptt
639  */
640 void
641 ecore_mcp_read_ufp_config(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
642 
643 /**
644  * @brief Get the engine affinity configuration.
645  *
646  * @param p_hwfn
647  * @param p_ptt
648  */
649 enum _ecore_status_t ecore_mcp_get_engine_config(struct ecore_hwfn *p_hwfn,
650 						 struct ecore_ptt *p_ptt);
651 
652 /**
653  * @brief Get the PPFID bitmap.
654  *
655  * @param p_hwfn
656  * @param p_ptt
657  */
658 enum _ecore_status_t ecore_mcp_get_ppfid_bitmap(struct ecore_hwfn *p_hwfn,
659 						struct ecore_ptt *p_ptt);
660 
661 /**
662  * @brief Acquire MCP lock to access to HW indirection table entries
663  *
664  * @param p_hwfn
665  * @param p_ptt
666  * @param retry_num
667  * @param retry_interval
668  */
669 enum _ecore_status_t
670 ecore_mcp_ind_table_lock(struct ecore_hwfn *p_hwfn,
671 			 struct ecore_ptt *p_ptt,
672 			 u8 retry_num,
673 			 u32 retry_interval);
674 
675 /**
676  * @brief Release MCP lock of access to HW indirection table entries
677  *
678  * @param p_hwfn
679  * @param p_ptt
680  */
681 enum _ecore_status_t
682 ecore_mcp_ind_table_unlock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
683 
684 #endif /* __ECORE_MCP_H__ */
685