linux/drivers/net/ethernet/intel/i40e/i40e_hmc.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2013 - 2018 Intel Corporation. */

#ifndef _I40E_HMC_H_
#define _I40E_HMC_H_

#include "i40e_alloc.h"
#include "i40e_io.h"
#include "i40e_register.h"

#define I40E_HMC_MAX_BP_COUNT

/* forward-declare the HW struct for the compiler */
struct i40e_hw;

#define I40E_HMC_INFO_SIGNATURE
#define I40E_HMC_PD_CNT_IN_SD
#define I40E_HMC_DIRECT_BP_SIZE
#define I40E_HMC_PAGED_BP_SIZE
#define I40E_HMC_PD_BP_BUF_ALIGNMENT

struct i40e_hmc_obj_info {};

enum i40e_sd_entry_type {};

struct i40e_hmc_bp {};

struct i40e_hmc_pd_entry {};

struct i40e_hmc_pd_table {};

struct i40e_hmc_sd_entry {};

struct i40e_hmc_sd_table {};

struct i40e_hmc_info {};

#define I40E_INC_SD_REFCNT(sd_table)
#define I40E_INC_PD_REFCNT(pd_table)
#define I40E_INC_BP_REFCNT(bp)

#define I40E_DEC_SD_REFCNT(sd_table)
#define I40E_DEC_PD_REFCNT(pd_table)
#define I40E_DEC_BP_REFCNT(bp)

/**
 * I40E_SET_PF_SD_ENTRY - marks the sd entry as valid in the hardware
 * @hw: pointer to our hw struct
 * @pa: pointer to physical address
 * @sd_index: segment descriptor index
 * @type: if sd entry is direct or paged
 **/
#define I40E_SET_PF_SD_ENTRY(hw, pa, sd_index, type)

/**
 * I40E_CLEAR_PF_SD_ENTRY - marks the sd entry as invalid in the hardware
 * @hw: pointer to our hw struct
 * @sd_index: segment descriptor index
 * @type: if sd entry is direct or paged
 **/
#define I40E_CLEAR_PF_SD_ENTRY(hw, sd_index, type)

/**
 * I40E_INVALIDATE_PF_HMC_PD - Invalidates the pd cache in the hardware
 * @hw: pointer to our hw struct
 * @sd_idx: segment descriptor index
 * @pd_idx: page descriptor index
 **/
#define I40E_INVALIDATE_PF_HMC_PD(hw, sd_idx, pd_idx)

/**
 * I40E_FIND_SD_INDEX_LIMIT - finds segment descriptor index limit
 * @hmc_info: pointer to the HMC configuration information structure
 * @type: type of HMC resources we're searching
 * @index: starting index for the object
 * @cnt: number of objects we're trying to create
 * @sd_idx: pointer to return index of the segment descriptor in question
 * @sd_limit: pointer to return the maximum number of segment descriptors
 *
 * This function calculates the segment descriptor index and index limit
 * for the resource defined by i40e_hmc_rsrc_type.
 **/
#define I40E_FIND_SD_INDEX_LIMIT(hmc_info, type, index, cnt, sd_idx, sd_limit)

/**
 * I40E_FIND_PD_INDEX_LIMIT - finds page descriptor index limit
 * @hmc_info: pointer to the HMC configuration information struct
 * @type: HMC resource type we're examining
 * @idx: starting index for the object
 * @cnt: number of objects we're trying to create
 * @pd_index: pointer to return page descriptor index
 * @pd_limit: pointer to return page descriptor index limit
 *
 * Calculates the page descriptor index and index limit for the resource
 * defined by i40e_hmc_rsrc_type.
 **/
#define I40E_FIND_PD_INDEX_LIMIT(hmc_info, type, idx, cnt, pd_index, pd_limit)

int i40e_add_sd_table_entry(struct i40e_hw *hw,
			    struct i40e_hmc_info *hmc_info,
			    u32 sd_index,
			    enum i40e_sd_entry_type type,
			    u64 direct_mode_sz);
int i40e_add_pd_table_entry(struct i40e_hw *hw,
			    struct i40e_hmc_info *hmc_info,
			    u32 pd_index,
			    struct i40e_dma_mem *rsrc_pg);
int i40e_remove_pd_bp(struct i40e_hw *hw,
		      struct i40e_hmc_info *hmc_info,
		      u32 idx);
int i40e_prep_remove_sd_bp(struct i40e_hmc_info *hmc_info,
			   u32 idx);
int i40e_remove_sd_bp_new(struct i40e_hw *hw,
			  struct i40e_hmc_info *hmc_info,
			  u32 idx, bool is_pf);
int i40e_prep_remove_pd_page(struct i40e_hmc_info *hmc_info,
			     u32 idx);
int i40e_remove_pd_page_new(struct i40e_hw *hw,
			    struct i40e_hmc_info *hmc_info,
			    u32 idx, bool is_pf);

#endif /* _I40E_HMC_H_ */