linux/drivers/net/ethernet/marvell/octeontx2/af/rvu.c

// SPDX-License-Identifier: GPL-2.0
/* Marvell RVU Admin Function driver
 *
 * Copyright (C) 2018 Marvell.
 *
 */

#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/pci.h>
#include <linux/sysfs.h>

#include "cgx.h"
#include "rvu.h"
#include "rvu_reg.h"
#include "ptp.h"
#include "mcs.h"

#include "rvu_trace.h"
#include "rvu_npc_hash.h"

#define DRV_NAME
#define DRV_STRING

static void rvu_set_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf,
				struct rvu_block *block, int lf);
static void rvu_clear_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf,
				  struct rvu_block *block, int lf);
static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc);

static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
			 int type, int num,
			 void (mbox_handler)(struct work_struct *),
			 void (mbox_up_handler)(struct work_struct *));
enum {};

/* Supported devices */
static const struct pci_device_id rvu_id_table[] =;

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_DEVICE_TABLE(pci, rvu_id_table);

static char *mkex_profile; /* MKEX profile name */
module_param(mkex_profile, charp, 0000);
MODULE_PARM_DESC();

static char *kpu_profile; /* KPU profile name */
module_param(kpu_profile, charp, 0000);
MODULE_PARM_DESC();

static void rvu_setup_hw_capabilities(struct rvu *rvu)
{}

/* Poll a RVU block's register 'offset', for a 'zero'
 * or 'nonzero' at bits specified by 'mask'
 */
int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero)
{}

int rvu_alloc_rsrc(struct rsrc_bmap *rsrc)
{}

int rvu_alloc_rsrc_contig(struct rsrc_bmap *rsrc, int nrsrc)
{}

void rvu_free_rsrc_contig(struct rsrc_bmap *rsrc, int nrsrc, int start)
{}

bool rvu_rsrc_check_contig(struct rsrc_bmap *rsrc, int nrsrc)
{}

void rvu_free_rsrc(struct rsrc_bmap *rsrc, int id)
{}

int rvu_rsrc_free_count(struct rsrc_bmap *rsrc)
{}

bool is_rsrc_free(struct rsrc_bmap *rsrc, int id)
{}

int rvu_alloc_bitmap(struct rsrc_bmap *rsrc)
{}

void rvu_free_bitmap(struct rsrc_bmap *rsrc)
{}

/* Get block LF's HW index from a PF_FUNC's block slot number */
int rvu_get_lf(struct rvu *rvu, struct rvu_block *block, u16 pcifunc, u16 slot)
{}

/* Convert BLOCK_TYPE_E to a BLOCK_ADDR_E.
 * Some silicon variants of OcteonTX2 supports
 * multiple blocks of same type.
 *
 * @pcifunc has to be zero when no LF is yet attached.
 *
 * For a pcifunc if LFs are attached from multiple blocks of same type, then
 * return blkaddr of first encountered block.
 */
int rvu_get_blkaddr(struct rvu *rvu, int blktype, u16 pcifunc)
{}

static void rvu_update_rsrc_map(struct rvu *rvu, struct rvu_pfvf *pfvf,
				struct rvu_block *block, u16 pcifunc,
				u16 lf, bool attach)
{}

inline int rvu_get_pf(u16 pcifunc)
{}

void rvu_get_pf_numvfs(struct rvu *rvu, int pf, int *numvfs, int *hwvf)
{}

int rvu_get_hwvf(struct rvu *rvu, int pcifunc)
{}

struct rvu_pfvf *rvu_get_pfvf(struct rvu *rvu, int pcifunc)
{}

static bool is_pf_func_valid(struct rvu *rvu, u16 pcifunc)
{}

bool is_block_implemented(struct rvu_hwinfo *hw, int blkaddr)
{}

static void rvu_check_block_implemented(struct rvu *rvu)
{}

static void rvu_setup_rvum_blk_revid(struct rvu *rvu)
{}

static void rvu_clear_rvum_blk_revid(struct rvu *rvu)
{}

int rvu_lf_reset(struct rvu *rvu, struct rvu_block *block, int lf)
{}

static void rvu_block_reset(struct rvu *rvu, int blkaddr, u64 rst_reg)
{}

static void rvu_reset_all_blocks(struct rvu *rvu)
{}

static void rvu_scan_block(struct rvu *rvu, struct rvu_block *block)
{}

static void rvu_check_min_msix_vec(struct rvu *rvu, int nvecs, int pf, int vf)
{}

static int rvu_setup_msix_resources(struct rvu *rvu)
{}

static void rvu_reset_msix(struct rvu *rvu)
{}

static void rvu_free_hw_resources(struct rvu *rvu)
{}

static void rvu_setup_pfvf_macaddress(struct rvu *rvu)
{}

static int rvu_fwdata_init(struct rvu *rvu)
{}

static void rvu_fwdata_exit(struct rvu *rvu)
{}

static int rvu_setup_nix_hw_resource(struct rvu *rvu, int blkaddr)
{}

static int rvu_setup_cpt_hw_resource(struct rvu *rvu, int blkaddr)
{}

static void rvu_get_lbk_bufsize(struct rvu *rvu)
{}

static int rvu_setup_hw_resources(struct rvu *rvu)
{}

/* NPA and NIX admin queue APIs */
void rvu_aq_free(struct rvu *rvu, struct admin_queue *aq)
{}

int rvu_aq_alloc(struct rvu *rvu, struct admin_queue **ad_queue,
		 int qsize, int inst_size, int res_size)
{}

int rvu_mbox_handler_ready(struct rvu *rvu, struct msg_req *req,
			   struct ready_msg_rsp *rsp)
{}

/* Get current count of a RVU block's LF/slots
 * provisioned to a given RVU func.
 */
u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blkaddr)
{}

/* Return true if LFs of block type are attached to pcifunc */
static bool is_blktype_attached(struct rvu_pfvf *pfvf, int blktype)
{}

bool is_pffunc_map_valid(struct rvu *rvu, u16 pcifunc, int blktype)
{}

static int rvu_lookup_rsrc(struct rvu *rvu, struct rvu_block *block,
			   int pcifunc, int slot)
{}

int rvu_get_blkaddr_from_slot(struct rvu *rvu, int blktype, u16 pcifunc,
			      u16 global_slot, u16 *slot_in_block)
{}

static void rvu_detach_block(struct rvu *rvu, int pcifunc, int blktype)
{}

static int rvu_detach_rsrcs(struct rvu *rvu, struct rsrc_detach *detach,
			    u16 pcifunc)
{}

int rvu_mbox_handler_detach_resources(struct rvu *rvu,
				      struct rsrc_detach *detach,
				      struct msg_rsp *rsp)
{}

int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc)
{}

static int rvu_get_attach_blkaddr(struct rvu *rvu, int blktype,
				  u16 pcifunc, struct rsrc_attach *attach)
{}

static void rvu_attach_block(struct rvu *rvu, int pcifunc, int blktype,
			     int num_lfs, struct rsrc_attach *attach)
{}

static int rvu_check_rsrc_availability(struct rvu *rvu,
				       struct rsrc_attach *req, u16 pcifunc)
{}

static bool rvu_attach_from_same_block(struct rvu *rvu, int blktype,
				       struct rsrc_attach *attach)
{}

int rvu_mbox_handler_attach_resources(struct rvu *rvu,
				      struct rsrc_attach *attach,
				      struct msg_rsp *rsp)
{}

static u16 rvu_get_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf,
			       int blkaddr, int lf)
{}

static void rvu_set_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf,
				struct rvu_block *block, int lf)
{}

static void rvu_clear_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf,
				  struct rvu_block *block, int lf)
{}

int rvu_mbox_handler_msix_offset(struct rvu *rvu, struct msg_req *req,
				 struct msix_offset_rsp *rsp)
{}

int rvu_mbox_handler_free_rsrc_cnt(struct rvu *rvu, struct msg_req *req,
				   struct free_rsrcs_rsp *rsp)
{}

int rvu_mbox_handler_vf_flr(struct rvu *rvu, struct msg_req *req,
			    struct msg_rsp *rsp)
{}

int rvu_ndc_sync(struct rvu *rvu, int lfblkaddr, int lfidx, u64 lfoffset)
{}

int rvu_mbox_handler_get_hw_cap(struct rvu *rvu, struct msg_req *req,
				struct get_hw_cap_rsp *rsp)
{}

int rvu_mbox_handler_set_vf_perm(struct rvu *rvu, struct set_vf_perm *req,
				 struct msg_rsp *rsp)
{}

int rvu_mbox_handler_ndc_sync_op(struct rvu *rvu,
				 struct ndc_sync_op *req,
				 struct msg_rsp *rsp)
{}

static int rvu_process_mbox_msg(struct otx2_mbox *mbox, int devid,
				struct mbox_msghdr *req)
{}

static void __rvu_mbox_handler(struct rvu_work *mwork, int type, bool poll)
{}

static inline void rvu_afpf_mbox_handler(struct work_struct *work)
{}

static inline void rvu_afvf_mbox_handler(struct work_struct *work)
{}

static void __rvu_mbox_up_handler(struct rvu_work *mwork, int type)
{}

static inline void rvu_afpf_mbox_up_handler(struct work_struct *work)
{}

static inline void rvu_afvf_mbox_up_handler(struct work_struct *work)
{}

static int rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr,
				int num, int type, unsigned long *pf_bmap)
{}

static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
			 int type, int num,
			 void (mbox_handler)(struct work_struct *),
			 void (mbox_up_handler)(struct work_struct *))
{}

static void rvu_mbox_destroy(struct mbox_wq_info *mw)
{}

static void rvu_queue_work(struct mbox_wq_info *mw, int first,
			   int mdevs, u64 intr)
{}

static irqreturn_t rvu_mbox_pf_intr_handler(int irq, void *rvu_irq)
{}

static irqreturn_t rvu_mbox_intr_handler(int irq, void *rvu_irq)
{}

static void rvu_enable_mbox_intr(struct rvu *rvu)
{}

static void rvu_blklf_teardown(struct rvu *rvu, u16 pcifunc, u8 blkaddr)
{}

static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc)
{}

static void rvu_afvf_flr_handler(struct rvu *rvu, int vf)
{}

static void rvu_flr_handler(struct work_struct *work)
{}

static void rvu_afvf_queue_flr_work(struct rvu *rvu, int start_vf, int numvfs)
{}

static irqreturn_t rvu_flr_intr_handler(int irq, void *rvu_irq)
{}

static void rvu_me_handle_vfset(struct rvu *rvu, int idx, u64 intr)
{}

/* Handles ME interrupts from VFs of AF */
static irqreturn_t rvu_me_vf_intr_handler(int irq, void *rvu_irq)
{}

/* Handles ME interrupts from PFs */
static irqreturn_t rvu_me_pf_intr_handler(int irq, void *rvu_irq)
{}

static void rvu_unregister_interrupts(struct rvu *rvu)
{}

static int rvu_afvf_msix_vectors_num_ok(struct rvu *rvu)
{}

static int rvu_register_interrupts(struct rvu *rvu)
{}

static void rvu_flr_wq_destroy(struct rvu *rvu)
{}

static int rvu_flr_init(struct rvu *rvu)
{}

static void rvu_disable_afvf_intr(struct rvu *rvu)
{}

static void rvu_enable_afvf_intr(struct rvu *rvu)
{}

int rvu_get_num_lbk_chans(void)
{}

static int rvu_enable_sriov(struct rvu *rvu)
{}

static void rvu_disable_sriov(struct rvu *rvu)
{}

static void rvu_update_module_params(struct rvu *rvu)
{}

static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{}

static void rvu_remove(struct pci_dev *pdev)
{}

static struct pci_driver rvu_driver =;

static int __init rvu_init_module(void)
{}

static void __exit rvu_cleanup_module(void)
{}

module_init();
module_exit(rvu_cleanup_module);