18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
28c2ecf20Sopenharmony_ci/* QLogic qed NIC Driver
38c2ecf20Sopenharmony_ci * Copyright (c) 2015-2017  QLogic Corporation
48c2ecf20Sopenharmony_ci * Copyright (c) 2019-2020 Marvell International Ltd.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef _QED_INT_H
88c2ecf20Sopenharmony_ci#define _QED_INT_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/types.h>
118c2ecf20Sopenharmony_ci#include <linux/slab.h>
128c2ecf20Sopenharmony_ci#include "qed.h"
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* Fields of IGU PF CONFIGURATION REGISTER */
158c2ecf20Sopenharmony_ci#define IGU_PF_CONF_FUNC_EN       (0x1 << 0)    /* function enable        */
168c2ecf20Sopenharmony_ci#define IGU_PF_CONF_MSI_MSIX_EN   (0x1 << 1)    /* MSI/MSIX enable        */
178c2ecf20Sopenharmony_ci#define IGU_PF_CONF_INT_LINE_EN   (0x1 << 2)    /* INT enable             */
188c2ecf20Sopenharmony_ci#define IGU_PF_CONF_ATTN_BIT_EN   (0x1 << 3)    /* attention enable       */
198c2ecf20Sopenharmony_ci#define IGU_PF_CONF_SINGLE_ISR_EN (0x1 << 4)    /* single ISR mode enable */
208c2ecf20Sopenharmony_ci#define IGU_PF_CONF_SIMD_MODE     (0x1 << 5)    /* simd all ones mode     */
218c2ecf20Sopenharmony_ci/* Fields of IGU VF CONFIGURATION REGISTER */
228c2ecf20Sopenharmony_ci#define IGU_VF_CONF_FUNC_EN        (0x1 << 0)	/* function enable        */
238c2ecf20Sopenharmony_ci#define IGU_VF_CONF_MSI_MSIX_EN    (0x1 << 1)	/* MSI/MSIX enable        */
248c2ecf20Sopenharmony_ci#define IGU_VF_CONF_SINGLE_ISR_EN  (0x1 << 4)	/* single ISR mode enable */
258c2ecf20Sopenharmony_ci#define IGU_VF_CONF_PARENT_MASK    (0xF)	/* Parent PF              */
268c2ecf20Sopenharmony_ci#define IGU_VF_CONF_PARENT_SHIFT   5		/* Parent PF              */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* Igu control commands
298c2ecf20Sopenharmony_ci */
308c2ecf20Sopenharmony_cienum igu_ctrl_cmd {
318c2ecf20Sopenharmony_ci	IGU_CTRL_CMD_TYPE_RD,
328c2ecf20Sopenharmony_ci	IGU_CTRL_CMD_TYPE_WR,
338c2ecf20Sopenharmony_ci	MAX_IGU_CTRL_CMD
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* Control register for the IGU command register
378c2ecf20Sopenharmony_ci */
388c2ecf20Sopenharmony_cistruct igu_ctrl_reg {
398c2ecf20Sopenharmony_ci	u32 ctrl_data;
408c2ecf20Sopenharmony_ci#define IGU_CTRL_REG_FID_MASK           0xFFFF  /* Opaque_FID	 */
418c2ecf20Sopenharmony_ci#define IGU_CTRL_REG_FID_SHIFT          0
428c2ecf20Sopenharmony_ci#define IGU_CTRL_REG_PXP_ADDR_MASK      0xFFF   /* Command address */
438c2ecf20Sopenharmony_ci#define IGU_CTRL_REG_PXP_ADDR_SHIFT     16
448c2ecf20Sopenharmony_ci#define IGU_CTRL_REG_RESERVED_MASK      0x1
458c2ecf20Sopenharmony_ci#define IGU_CTRL_REG_RESERVED_SHIFT     28
468c2ecf20Sopenharmony_ci#define IGU_CTRL_REG_TYPE_MASK          0x1 /* use enum igu_ctrl_cmd */
478c2ecf20Sopenharmony_ci#define IGU_CTRL_REG_TYPE_SHIFT         31
488c2ecf20Sopenharmony_ci};
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_cienum qed_coalescing_fsm {
518c2ecf20Sopenharmony_ci	QED_COAL_RX_STATE_MACHINE,
528c2ecf20Sopenharmony_ci	QED_COAL_TX_STATE_MACHINE
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/**
568c2ecf20Sopenharmony_ci * @brief qed_int_igu_enable_int - enable device interrupts
578c2ecf20Sopenharmony_ci *
588c2ecf20Sopenharmony_ci * @param p_hwfn
598c2ecf20Sopenharmony_ci * @param p_ptt
608c2ecf20Sopenharmony_ci * @param int_mode - interrupt mode to use
618c2ecf20Sopenharmony_ci */
628c2ecf20Sopenharmony_civoid qed_int_igu_enable_int(struct qed_hwfn *p_hwfn,
638c2ecf20Sopenharmony_ci			    struct qed_ptt *p_ptt,
648c2ecf20Sopenharmony_ci			    enum qed_int_mode int_mode);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/**
678c2ecf20Sopenharmony_ci * @brief qed_int_igu_disable_int - disable device interrupts
688c2ecf20Sopenharmony_ci *
698c2ecf20Sopenharmony_ci * @param p_hwfn
708c2ecf20Sopenharmony_ci * @param p_ptt
718c2ecf20Sopenharmony_ci */
728c2ecf20Sopenharmony_civoid qed_int_igu_disable_int(struct qed_hwfn *p_hwfn,
738c2ecf20Sopenharmony_ci			     struct qed_ptt *p_ptt);
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/**
768c2ecf20Sopenharmony_ci * @brief qed_int_igu_read_sisr_reg - Reads the single isr multiple dpc
778c2ecf20Sopenharmony_ci *        register from igu.
788c2ecf20Sopenharmony_ci *
798c2ecf20Sopenharmony_ci * @param p_hwfn
808c2ecf20Sopenharmony_ci *
818c2ecf20Sopenharmony_ci * @return u64
828c2ecf20Sopenharmony_ci */
838c2ecf20Sopenharmony_ciu64 qed_int_igu_read_sisr_reg(struct qed_hwfn *p_hwfn);
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#define QED_SP_SB_ID 0xffff
868c2ecf20Sopenharmony_ci/**
878c2ecf20Sopenharmony_ci * @brief qed_int_sb_init - Initializes the sb_info structure.
888c2ecf20Sopenharmony_ci *
898c2ecf20Sopenharmony_ci * once the structure is initialized it can be passed to sb related functions.
908c2ecf20Sopenharmony_ci *
918c2ecf20Sopenharmony_ci * @param p_hwfn
928c2ecf20Sopenharmony_ci * @param p_ptt
938c2ecf20Sopenharmony_ci * @param sb_info	points to an uninitialized (but
948c2ecf20Sopenharmony_ci *			allocated) sb_info structure
958c2ecf20Sopenharmony_ci * @param sb_virt_addr
968c2ecf20Sopenharmony_ci * @param sb_phy_addr
978c2ecf20Sopenharmony_ci * @param sb_id	the sb_id to be used (zero based in driver)
988c2ecf20Sopenharmony_ci *			should use QED_SP_SB_ID for SP Status block
998c2ecf20Sopenharmony_ci *
1008c2ecf20Sopenharmony_ci * @return int
1018c2ecf20Sopenharmony_ci */
1028c2ecf20Sopenharmony_ciint qed_int_sb_init(struct qed_hwfn *p_hwfn,
1038c2ecf20Sopenharmony_ci		    struct qed_ptt *p_ptt,
1048c2ecf20Sopenharmony_ci		    struct qed_sb_info *sb_info,
1058c2ecf20Sopenharmony_ci		    void *sb_virt_addr,
1068c2ecf20Sopenharmony_ci		    dma_addr_t sb_phy_addr,
1078c2ecf20Sopenharmony_ci		    u16 sb_id);
1088c2ecf20Sopenharmony_ci/**
1098c2ecf20Sopenharmony_ci * @brief qed_int_sb_setup - Setup the sb.
1108c2ecf20Sopenharmony_ci *
1118c2ecf20Sopenharmony_ci * @param p_hwfn
1128c2ecf20Sopenharmony_ci * @param p_ptt
1138c2ecf20Sopenharmony_ci * @param sb_info	initialized sb_info structure
1148c2ecf20Sopenharmony_ci */
1158c2ecf20Sopenharmony_civoid qed_int_sb_setup(struct qed_hwfn *p_hwfn,
1168c2ecf20Sopenharmony_ci		      struct qed_ptt *p_ptt,
1178c2ecf20Sopenharmony_ci		      struct qed_sb_info *sb_info);
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci/**
1208c2ecf20Sopenharmony_ci * @brief qed_int_sb_release - releases the sb_info structure.
1218c2ecf20Sopenharmony_ci *
1228c2ecf20Sopenharmony_ci * once the structure is released, it's memory can be freed
1238c2ecf20Sopenharmony_ci *
1248c2ecf20Sopenharmony_ci * @param p_hwfn
1258c2ecf20Sopenharmony_ci * @param sb_info	points to an allocated sb_info structure
1268c2ecf20Sopenharmony_ci * @param sb_id		the sb_id to be used (zero based in driver)
1278c2ecf20Sopenharmony_ci *			should never be equal to QED_SP_SB_ID
1288c2ecf20Sopenharmony_ci *			(SP Status block)
1298c2ecf20Sopenharmony_ci *
1308c2ecf20Sopenharmony_ci * @return int
1318c2ecf20Sopenharmony_ci */
1328c2ecf20Sopenharmony_ciint qed_int_sb_release(struct qed_hwfn *p_hwfn,
1338c2ecf20Sopenharmony_ci		       struct qed_sb_info *sb_info,
1348c2ecf20Sopenharmony_ci		       u16 sb_id);
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci/**
1378c2ecf20Sopenharmony_ci * @brief qed_int_sp_dpc - To be called when an interrupt is received on the
1388c2ecf20Sopenharmony_ci *        default status block.
1398c2ecf20Sopenharmony_ci *
1408c2ecf20Sopenharmony_ci * @param p_hwfn - pointer to hwfn
1418c2ecf20Sopenharmony_ci *
1428c2ecf20Sopenharmony_ci */
1438c2ecf20Sopenharmony_civoid qed_int_sp_dpc(struct tasklet_struct *t);
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci/**
1468c2ecf20Sopenharmony_ci * @brief qed_int_get_num_sbs - get the number of status
1478c2ecf20Sopenharmony_ci *        blocks configured for this funciton in the igu.
1488c2ecf20Sopenharmony_ci *
1498c2ecf20Sopenharmony_ci * @param p_hwfn
1508c2ecf20Sopenharmony_ci * @param p_sb_cnt_info
1518c2ecf20Sopenharmony_ci *
1528c2ecf20Sopenharmony_ci * @return int - number of status blocks configured
1538c2ecf20Sopenharmony_ci */
1548c2ecf20Sopenharmony_civoid qed_int_get_num_sbs(struct qed_hwfn	*p_hwfn,
1558c2ecf20Sopenharmony_ci			 struct qed_sb_cnt_info *p_sb_cnt_info);
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/**
1588c2ecf20Sopenharmony_ci * @brief qed_int_disable_post_isr_release - performs the cleanup post ISR
1598c2ecf20Sopenharmony_ci *        release. The API need to be called after releasing all slowpath IRQs
1608c2ecf20Sopenharmony_ci *        of the device.
1618c2ecf20Sopenharmony_ci *
1628c2ecf20Sopenharmony_ci * @param cdev
1638c2ecf20Sopenharmony_ci *
1648c2ecf20Sopenharmony_ci */
1658c2ecf20Sopenharmony_civoid qed_int_disable_post_isr_release(struct qed_dev *cdev);
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/**
1688c2ecf20Sopenharmony_ci * @brief qed_int_attn_clr_enable - sets whether the general behavior is
1698c2ecf20Sopenharmony_ci *        preventing attentions from being reasserted, or following the
1708c2ecf20Sopenharmony_ci *        attributes of the specific attention.
1718c2ecf20Sopenharmony_ci *
1728c2ecf20Sopenharmony_ci * @param cdev
1738c2ecf20Sopenharmony_ci * @param clr_enable
1748c2ecf20Sopenharmony_ci *
1758c2ecf20Sopenharmony_ci */
1768c2ecf20Sopenharmony_civoid qed_int_attn_clr_enable(struct qed_dev *cdev, bool clr_enable);
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci/**
1798c2ecf20Sopenharmony_ci * @brief - Doorbell Recovery handler.
1808c2ecf20Sopenharmony_ci *          Run doorbell recovery in case of PF overflow (and flush DORQ if
1818c2ecf20Sopenharmony_ci *          needed).
1828c2ecf20Sopenharmony_ci *
1838c2ecf20Sopenharmony_ci * @param p_hwfn
1848c2ecf20Sopenharmony_ci * @param p_ptt
1858c2ecf20Sopenharmony_ci */
1868c2ecf20Sopenharmony_ciint qed_db_rec_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci#define QED_CAU_DEF_RX_TIMER_RES 0
1898c2ecf20Sopenharmony_ci#define QED_CAU_DEF_TX_TIMER_RES 0
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci#define QED_SB_ATT_IDX  0x0001
1928c2ecf20Sopenharmony_ci#define QED_SB_EVENT_MASK       0x0003
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci#define SB_ALIGNED_SIZE(p_hwfn)	\
1958c2ecf20Sopenharmony_ci	ALIGNED_TYPE_SIZE(struct status_block_e4, p_hwfn)
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci#define QED_SB_INVALID_IDX      0xffff
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_cistruct qed_igu_block {
2008c2ecf20Sopenharmony_ci	u8 status;
2018c2ecf20Sopenharmony_ci#define QED_IGU_STATUS_FREE     0x01
2028c2ecf20Sopenharmony_ci#define QED_IGU_STATUS_VALID    0x02
2038c2ecf20Sopenharmony_ci#define QED_IGU_STATUS_PF       0x04
2048c2ecf20Sopenharmony_ci#define QED_IGU_STATUS_DSB      0x08
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci	u8 vector_number;
2078c2ecf20Sopenharmony_ci	u8 function_id;
2088c2ecf20Sopenharmony_ci	u8 is_pf;
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci	/* Index inside IGU [meant for back reference] */
2118c2ecf20Sopenharmony_ci	u16 igu_sb_id;
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci	struct qed_sb_info *sb_info;
2148c2ecf20Sopenharmony_ci};
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_cistruct qed_igu_info {
2178c2ecf20Sopenharmony_ci	struct qed_igu_block entry[MAX_TOT_SB_PER_PATH];
2188c2ecf20Sopenharmony_ci	u16 igu_dsb_id;
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci	struct qed_sb_cnt_info usage;
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci	bool b_allow_pf_vf_change;
2238c2ecf20Sopenharmony_ci};
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci/**
2268c2ecf20Sopenharmony_ci * @brief - Make sure the IGU CAM reflects the resources provided by MFW
2278c2ecf20Sopenharmony_ci *
2288c2ecf20Sopenharmony_ci * @param p_hwfn
2298c2ecf20Sopenharmony_ci * @param p_ptt
2308c2ecf20Sopenharmony_ci */
2318c2ecf20Sopenharmony_ciint qed_int_igu_reset_cam(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci/**
2348c2ecf20Sopenharmony_ci * @brief Translate the weakly-defined client sb-id into an IGU sb-id
2358c2ecf20Sopenharmony_ci *
2368c2ecf20Sopenharmony_ci * @param p_hwfn
2378c2ecf20Sopenharmony_ci * @param sb_id - user provided sb_id
2388c2ecf20Sopenharmony_ci *
2398c2ecf20Sopenharmony_ci * @return an index inside IGU CAM where the SB resides
2408c2ecf20Sopenharmony_ci */
2418c2ecf20Sopenharmony_ciu16 qed_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id);
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci/**
2448c2ecf20Sopenharmony_ci * @brief return a pointer to an unused valid SB
2458c2ecf20Sopenharmony_ci *
2468c2ecf20Sopenharmony_ci * @param p_hwfn
2478c2ecf20Sopenharmony_ci * @param b_is_pf - true iff we want a SB belonging to a PF
2488c2ecf20Sopenharmony_ci *
2498c2ecf20Sopenharmony_ci * @return point to an igu_block, NULL if none is available
2508c2ecf20Sopenharmony_ci */
2518c2ecf20Sopenharmony_cistruct qed_igu_block *qed_get_igu_free_sb(struct qed_hwfn *p_hwfn,
2528c2ecf20Sopenharmony_ci					  bool b_is_pf);
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_civoid qed_int_igu_init_pure_rt(struct qed_hwfn *p_hwfn,
2558c2ecf20Sopenharmony_ci			      struct qed_ptt *p_ptt,
2568c2ecf20Sopenharmony_ci			      bool b_set,
2578c2ecf20Sopenharmony_ci			      bool b_slowpath);
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_civoid qed_int_igu_init_rt(struct qed_hwfn *p_hwfn);
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci/**
2628c2ecf20Sopenharmony_ci * @brief qed_int_igu_read_cam - Reads the IGU CAM.
2638c2ecf20Sopenharmony_ci *	This function needs to be called during hardware
2648c2ecf20Sopenharmony_ci *	prepare. It reads the info from igu cam to know which
2658c2ecf20Sopenharmony_ci *	status block is the default / base status block etc.
2668c2ecf20Sopenharmony_ci *
2678c2ecf20Sopenharmony_ci * @param p_hwfn
2688c2ecf20Sopenharmony_ci * @param p_ptt
2698c2ecf20Sopenharmony_ci *
2708c2ecf20Sopenharmony_ci * @return int
2718c2ecf20Sopenharmony_ci */
2728c2ecf20Sopenharmony_ciint qed_int_igu_read_cam(struct qed_hwfn *p_hwfn,
2738c2ecf20Sopenharmony_ci			 struct qed_ptt *p_ptt);
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_citypedef int (*qed_int_comp_cb_t)(struct qed_hwfn *p_hwfn,
2768c2ecf20Sopenharmony_ci				 void *cookie);
2778c2ecf20Sopenharmony_ci/**
2788c2ecf20Sopenharmony_ci * @brief qed_int_register_cb - Register callback func for
2798c2ecf20Sopenharmony_ci *      slowhwfn statusblock.
2808c2ecf20Sopenharmony_ci *
2818c2ecf20Sopenharmony_ci *	Every protocol that uses the slowhwfn status block
2828c2ecf20Sopenharmony_ci *	should register a callback function that will be called
2838c2ecf20Sopenharmony_ci *	once there is an update of the sp status block.
2848c2ecf20Sopenharmony_ci *
2858c2ecf20Sopenharmony_ci * @param p_hwfn
2868c2ecf20Sopenharmony_ci * @param comp_cb - function to be called when there is an
2878c2ecf20Sopenharmony_ci *                  interrupt on the sp sb
2888c2ecf20Sopenharmony_ci *
2898c2ecf20Sopenharmony_ci * @param cookie  - passed to the callback function
2908c2ecf20Sopenharmony_ci * @param sb_idx  - OUT parameter which gives the chosen index
2918c2ecf20Sopenharmony_ci *                  for this protocol.
2928c2ecf20Sopenharmony_ci * @param p_fw_cons  - pointer to the actual address of the
2938c2ecf20Sopenharmony_ci *                     consumer for this protocol.
2948c2ecf20Sopenharmony_ci *
2958c2ecf20Sopenharmony_ci * @return int
2968c2ecf20Sopenharmony_ci */
2978c2ecf20Sopenharmony_ciint qed_int_register_cb(struct qed_hwfn *p_hwfn,
2988c2ecf20Sopenharmony_ci			qed_int_comp_cb_t comp_cb,
2998c2ecf20Sopenharmony_ci			void *cookie,
3008c2ecf20Sopenharmony_ci			u8 *sb_idx,
3018c2ecf20Sopenharmony_ci			__le16 **p_fw_cons);
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci/**
3048c2ecf20Sopenharmony_ci * @brief qed_int_unregister_cb - Unregisters callback
3058c2ecf20Sopenharmony_ci *      function from sp sb.
3068c2ecf20Sopenharmony_ci *      Partner of qed_int_register_cb -> should be called
3078c2ecf20Sopenharmony_ci *      when no longer required.
3088c2ecf20Sopenharmony_ci *
3098c2ecf20Sopenharmony_ci * @param p_hwfn
3108c2ecf20Sopenharmony_ci * @param pi
3118c2ecf20Sopenharmony_ci *
3128c2ecf20Sopenharmony_ci * @return int
3138c2ecf20Sopenharmony_ci */
3148c2ecf20Sopenharmony_ciint qed_int_unregister_cb(struct qed_hwfn *p_hwfn,
3158c2ecf20Sopenharmony_ci			  u8 pi);
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci/**
3188c2ecf20Sopenharmony_ci * @brief qed_int_get_sp_sb_id - Get the slowhwfn sb id.
3198c2ecf20Sopenharmony_ci *
3208c2ecf20Sopenharmony_ci * @param p_hwfn
3218c2ecf20Sopenharmony_ci *
3228c2ecf20Sopenharmony_ci * @return u16
3238c2ecf20Sopenharmony_ci */
3248c2ecf20Sopenharmony_ciu16 qed_int_get_sp_sb_id(struct qed_hwfn *p_hwfn);
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci/**
3278c2ecf20Sopenharmony_ci * @brief Status block cleanup. Should be called for each status
3288c2ecf20Sopenharmony_ci *        block that will be used -> both PF / VF
3298c2ecf20Sopenharmony_ci *
3308c2ecf20Sopenharmony_ci * @param p_hwfn
3318c2ecf20Sopenharmony_ci * @param p_ptt
3328c2ecf20Sopenharmony_ci * @param igu_sb_id	- igu status block id
3338c2ecf20Sopenharmony_ci * @param opaque	- opaque fid of the sb owner.
3348c2ecf20Sopenharmony_ci * @param b_set		- set(1) / clear(0)
3358c2ecf20Sopenharmony_ci */
3368c2ecf20Sopenharmony_civoid qed_int_igu_init_pure_rt_single(struct qed_hwfn *p_hwfn,
3378c2ecf20Sopenharmony_ci				     struct qed_ptt *p_ptt,
3388c2ecf20Sopenharmony_ci				     u16 igu_sb_id,
3398c2ecf20Sopenharmony_ci				     u16 opaque,
3408c2ecf20Sopenharmony_ci				     bool b_set);
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci/**
3438c2ecf20Sopenharmony_ci * @brief qed_int_cau_conf - configure cau for a given status
3448c2ecf20Sopenharmony_ci *        block
3458c2ecf20Sopenharmony_ci *
3468c2ecf20Sopenharmony_ci * @param p_hwfn
3478c2ecf20Sopenharmony_ci * @param ptt
3488c2ecf20Sopenharmony_ci * @param sb_phys
3498c2ecf20Sopenharmony_ci * @param igu_sb_id
3508c2ecf20Sopenharmony_ci * @param vf_number
3518c2ecf20Sopenharmony_ci * @param vf_valid
3528c2ecf20Sopenharmony_ci */
3538c2ecf20Sopenharmony_civoid qed_int_cau_conf_sb(struct qed_hwfn *p_hwfn,
3548c2ecf20Sopenharmony_ci			 struct qed_ptt *p_ptt,
3558c2ecf20Sopenharmony_ci			 dma_addr_t sb_phys,
3568c2ecf20Sopenharmony_ci			 u16 igu_sb_id,
3578c2ecf20Sopenharmony_ci			 u16 vf_number,
3588c2ecf20Sopenharmony_ci			 u8 vf_valid);
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci/**
3618c2ecf20Sopenharmony_ci * @brief qed_int_alloc
3628c2ecf20Sopenharmony_ci *
3638c2ecf20Sopenharmony_ci * @param p_hwfn
3648c2ecf20Sopenharmony_ci * @param p_ptt
3658c2ecf20Sopenharmony_ci *
3668c2ecf20Sopenharmony_ci * @return int
3678c2ecf20Sopenharmony_ci */
3688c2ecf20Sopenharmony_ciint qed_int_alloc(struct qed_hwfn *p_hwfn,
3698c2ecf20Sopenharmony_ci		  struct qed_ptt *p_ptt);
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci/**
3728c2ecf20Sopenharmony_ci * @brief qed_int_free
3738c2ecf20Sopenharmony_ci *
3748c2ecf20Sopenharmony_ci * @param p_hwfn
3758c2ecf20Sopenharmony_ci */
3768c2ecf20Sopenharmony_civoid qed_int_free(struct qed_hwfn *p_hwfn);
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_ci/**
3798c2ecf20Sopenharmony_ci * @brief qed_int_setup
3808c2ecf20Sopenharmony_ci *
3818c2ecf20Sopenharmony_ci * @param p_hwfn
3828c2ecf20Sopenharmony_ci * @param p_ptt
3838c2ecf20Sopenharmony_ci */
3848c2ecf20Sopenharmony_civoid qed_int_setup(struct qed_hwfn *p_hwfn,
3858c2ecf20Sopenharmony_ci		   struct qed_ptt *p_ptt);
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci/**
3888c2ecf20Sopenharmony_ci * @brief - Enable Interrupt & Attention for hw function
3898c2ecf20Sopenharmony_ci *
3908c2ecf20Sopenharmony_ci * @param p_hwfn
3918c2ecf20Sopenharmony_ci * @param p_ptt
3928c2ecf20Sopenharmony_ci * @param int_mode
3938c2ecf20Sopenharmony_ci *
3948c2ecf20Sopenharmony_ci * @return int
3958c2ecf20Sopenharmony_ci */
3968c2ecf20Sopenharmony_ciint qed_int_igu_enable(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
3978c2ecf20Sopenharmony_ci		       enum qed_int_mode int_mode);
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci/**
4008c2ecf20Sopenharmony_ci * @brief - Initialize CAU status block entry
4018c2ecf20Sopenharmony_ci *
4028c2ecf20Sopenharmony_ci * @param p_hwfn
4038c2ecf20Sopenharmony_ci * @param p_sb_entry
4048c2ecf20Sopenharmony_ci * @param pf_id
4058c2ecf20Sopenharmony_ci * @param vf_number
4068c2ecf20Sopenharmony_ci * @param vf_valid
4078c2ecf20Sopenharmony_ci */
4088c2ecf20Sopenharmony_civoid qed_init_cau_sb_entry(struct qed_hwfn *p_hwfn,
4098c2ecf20Sopenharmony_ci			   struct cau_sb_entry *p_sb_entry,
4108c2ecf20Sopenharmony_ci			   u8 pf_id,
4118c2ecf20Sopenharmony_ci			   u16 vf_number,
4128c2ecf20Sopenharmony_ci			   u8 vf_valid);
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ciint qed_int_set_timer_res(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
4158c2ecf20Sopenharmony_ci			  u8 timer_res, u16 sb_id, bool tx);
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_ci#define QED_MAPPING_MEMORY_SIZE(dev)	(NUM_OF_SBS(dev))
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ciint qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
4208c2ecf20Sopenharmony_ci				bool hw_init);
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ci#endif
423