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