xref: /linux/drivers/net/ethernet/qlogic/qed/qed_init_ops.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
11f4d4ed6SAlexander Lobakin /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2fe56b9e6SYuval Mintz /* QLogic qed NIC Driver
3e8f1cb50SMintz, Yuval  * Copyright (c) 2015-2017  QLogic Corporation
4663eacd8SAlexander Lobakin  * Copyright (c) 2019-2020 Marvell International Ltd.
5fe56b9e6SYuval Mintz  */
6fe56b9e6SYuval Mintz 
7fe56b9e6SYuval Mintz #ifndef _QED_INIT_OPS_H
8fe56b9e6SYuval Mintz #define _QED_INIT_OPS_H
9fe56b9e6SYuval Mintz 
10fe56b9e6SYuval Mintz #include <linux/types.h>
11fe56b9e6SYuval Mintz #include <linux/slab.h>
12fe56b9e6SYuval Mintz #include "qed.h"
13fe56b9e6SYuval Mintz 
14fe56b9e6SYuval Mintz /**
1519198e4eSPrabhakar Kushwaha  * qed_init_iro_array(): init iro_arr.
16fe56b9e6SYuval Mintz  *
1719198e4eSPrabhakar Kushwaha  * @cdev: Qed dev pointer.
18fe56b9e6SYuval Mintz  *
1919198e4eSPrabhakar Kushwaha  * Return: Void.
20fe56b9e6SYuval Mintz  */
21fe56b9e6SYuval Mintz void qed_init_iro_array(struct qed_dev *cdev);
22fe56b9e6SYuval Mintz 
23fe56b9e6SYuval Mintz /**
2419198e4eSPrabhakar Kushwaha  * qed_init_run(): Run the init-sequence.
25fe56b9e6SYuval Mintz  *
2619198e4eSPrabhakar Kushwaha  * @p_hwfn: HW device data.
2719198e4eSPrabhakar Kushwaha  * @p_ptt: P_ptt.
2819198e4eSPrabhakar Kushwaha  * @phase: Phase.
2919198e4eSPrabhakar Kushwaha  * @phase_id: Phase ID.
3019198e4eSPrabhakar Kushwaha  * @modes: Mode.
31fe56b9e6SYuval Mintz  *
3219198e4eSPrabhakar Kushwaha  * Return: _qed_status_t
33fe56b9e6SYuval Mintz  */
34fe56b9e6SYuval Mintz int qed_init_run(struct qed_hwfn *p_hwfn,
35fe56b9e6SYuval Mintz 		 struct qed_ptt *p_ptt,
36fe56b9e6SYuval Mintz 		 int phase,
37fe56b9e6SYuval Mintz 		 int phase_id,
38fe56b9e6SYuval Mintz 		 int modes);
39fe56b9e6SYuval Mintz 
40fe56b9e6SYuval Mintz /**
4119198e4eSPrabhakar Kushwaha  * qed_init_alloc(): Allocate RT array, Store 'values' ptrs.
42fe56b9e6SYuval Mintz  *
4319198e4eSPrabhakar Kushwaha  * @p_hwfn: HW device data.
44fe56b9e6SYuval Mintz  *
4519198e4eSPrabhakar Kushwaha  * Return: _qed_status_t.
46fe56b9e6SYuval Mintz  */
47fe56b9e6SYuval Mintz int qed_init_alloc(struct qed_hwfn *p_hwfn);
48fe56b9e6SYuval Mintz 
49fe56b9e6SYuval Mintz /**
5019198e4eSPrabhakar Kushwaha  * qed_init_free(): Init HW function deallocate.
51fe56b9e6SYuval Mintz  *
5219198e4eSPrabhakar Kushwaha  * @p_hwfn: HW device data.
53fe56b9e6SYuval Mintz  *
5419198e4eSPrabhakar Kushwaha  * Return: Void.
55fe56b9e6SYuval Mintz  */
56fe56b9e6SYuval Mintz void qed_init_free(struct qed_hwfn *p_hwfn);
57fe56b9e6SYuval Mintz 
58fe56b9e6SYuval Mintz /**
5919198e4eSPrabhakar Kushwaha  * qed_init_store_rt_reg(): Store a configuration value in the RT array.
60fe56b9e6SYuval Mintz  *
6119198e4eSPrabhakar Kushwaha  * @p_hwfn: HW device data.
6219198e4eSPrabhakar Kushwaha  * @rt_offset: RT offset.
6319198e4eSPrabhakar Kushwaha  * @val: Val.
64fe56b9e6SYuval Mintz  *
6519198e4eSPrabhakar Kushwaha  * Return: Void.
66fe56b9e6SYuval Mintz  */
67fe56b9e6SYuval Mintz void qed_init_store_rt_reg(struct qed_hwfn *p_hwfn,
68fe56b9e6SYuval Mintz 			   u32 rt_offset,
69fe56b9e6SYuval Mintz 			   u32 val);
70fe56b9e6SYuval Mintz 
71fe56b9e6SYuval Mintz #define STORE_RT_REG(hwfn, offset, val)	\
72fe56b9e6SYuval Mintz 	qed_init_store_rt_reg(hwfn, offset, val)
73fe56b9e6SYuval Mintz 
74fe56b9e6SYuval Mintz #define OVERWRITE_RT_REG(hwfn, offset, val) \
75fe56b9e6SYuval Mintz 	qed_init_store_rt_reg(hwfn, offset, val)
76fe56b9e6SYuval Mintz 
77fe56b9e6SYuval Mintz void qed_init_store_rt_agg(struct qed_hwfn *p_hwfn,
78fe56b9e6SYuval Mintz 			   u32 rt_offset,
79fe56b9e6SYuval Mintz 			   u32 *val,
80fe56b9e6SYuval Mintz 			   size_t size);
81fe56b9e6SYuval Mintz 
82fe56b9e6SYuval Mintz #define STORE_RT_REG_AGG(hwfn, offset, val) \
83*b90cb538SOmkar Kulkarni 	qed_init_store_rt_agg(hwfn, offset, (u32 *)&(val), sizeof(val))
84fe56b9e6SYuval Mintz 
85fe56b9e6SYuval Mintz /**
8619198e4eSPrabhakar Kushwaha  * qed_gtt_init(): Initialize GTT global windows and set admin window
87fe56b9e6SYuval Mintz  *                 related params of GTT/PTT to default values.
88fe56b9e6SYuval Mintz  *
8919198e4eSPrabhakar Kushwaha  * @p_hwfn: HW device data.
9019198e4eSPrabhakar Kushwaha  *
9119198e4eSPrabhakar Kushwaha  * Return Void.
92fe56b9e6SYuval Mintz  */
93fe56b9e6SYuval Mintz void qed_gtt_init(struct qed_hwfn *p_hwfn);
94fe56b9e6SYuval Mintz #endif
95