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