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