1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2 /* QLogic qed NIC Driver
3  * Copyright (c) 2015-2017  QLogic Corporation
4  */
5 
6 #ifndef _QED_INIT_OPS_H
7 #define _QED_INIT_OPS_H
8 
9 #include <linux/types.h>
10 #include <linux/slab.h>
11 #include "qed.h"
12 
13 /**
14  * @brief qed_init_iro_array - init iro_arr.
15  *
16  *
17  * @param cdev
18  */
19 void qed_init_iro_array(struct qed_dev *cdev);
20 
21 /**
22  * @brief qed_init_run - Run the init-sequence.
23  *
24  *
25  * @param p_hwfn
26  * @param p_ptt
27  * @param phase
28  * @param phase_id
29  * @param modes
30  * @return _qed_status_t
31  */
32 int qed_init_run(struct qed_hwfn *p_hwfn,
33 		 struct qed_ptt *p_ptt,
34 		 int phase,
35 		 int phase_id,
36 		 int modes);
37 
38 /**
39  * @brief qed_init_hwfn_allocate - Allocate RT array, Store 'values' ptrs.
40  *
41  *
42  * @param p_hwfn
43  *
44  * @return _qed_status_t
45  */
46 int qed_init_alloc(struct qed_hwfn *p_hwfn);
47 
48 /**
49  * @brief qed_init_hwfn_deallocate
50  *
51  *
52  * @param p_hwfn
53  */
54 void qed_init_free(struct qed_hwfn *p_hwfn);
55 
56 /**
57  * @brief qed_init_store_rt_reg - Store a configuration value in the RT array.
58  *
59  *
60  * @param p_hwfn
61  * @param rt_offset
62  * @param val
63  */
64 void qed_init_store_rt_reg(struct qed_hwfn *p_hwfn,
65 			   u32 rt_offset,
66 			   u32 val);
67 
68 #define STORE_RT_REG(hwfn, offset, val)	\
69 	qed_init_store_rt_reg(hwfn, offset, val)
70 
71 #define OVERWRITE_RT_REG(hwfn, offset, val) \
72 	qed_init_store_rt_reg(hwfn, offset, val)
73 
74 /**
75  * @brief
76  *
77  *
78  * @param p_hwfn
79  * @param rt_offset
80  * @param val
81  * @param size
82  */
83 void qed_init_store_rt_agg(struct qed_hwfn *p_hwfn,
84 			   u32 rt_offset,
85 			   u32 *val,
86 			   size_t size);
87 
88 #define STORE_RT_REG_AGG(hwfn, offset, val) \
89 	qed_init_store_rt_agg(hwfn, offset, (u32 *)&val, sizeof(val))
90 
91 /**
92  * @brief
93  *      Initialize GTT global windows and set admin window
94  *      related params of GTT/PTT to default values.
95  *
96  * @param p_hwfn
97  */
98 void qed_gtt_init(struct qed_hwfn *p_hwfn);
99 #endif
100