linux/drivers/net/ethernet/fungible/funcore/fun_dev.h

/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */

#ifndef _FUNDEV_H
#define _FUNDEV_H

#include <linux/sbitmap.h>
#include <linux/spinlock_types.h>
#include <linux/workqueue.h>
#include "fun_hci.h"

struct pci_dev;
struct fun_dev;
struct fun_queue;
struct fun_cmd_ctx;
struct fun_queue_alloc_req;

/* doorbell fields */
enum {};

/* Callback for asynchronous admin commands.
 * Invoked on reception of command response.
 */
fun_admin_callback_t;

/* Callback for events/notifications received by an admin queue. */
fun_admin_event_cb;

/* Callback for pending work handled by the service task. */
fun_serv_cb;

/* service task flags */
enum {};

/* Driver state associated with a PCI function. */
struct fun_dev {};

struct fun_dev_params {};

/* Return the BAR address of a doorbell. */
static inline u32 __iomem *fun_db_addr(const struct fun_dev *fdev,
				       unsigned int db_index)
{}

/* Return the BAR address of an SQ doorbell. SQ and CQ DBs alternate,
 * SQs have even DB indices.
 */
static inline u32 __iomem *fun_sq_db_addr(const struct fun_dev *fdev,
					  unsigned int sqid)
{}

static inline u32 __iomem *fun_cq_db_addr(const struct fun_dev *fdev,
					  unsigned int cqid)
{}

int fun_get_res_count(struct fun_dev *fdev, enum fun_admin_op res);
int fun_res_destroy(struct fun_dev *fdev, enum fun_admin_op res,
		    unsigned int flags, u32 id);
int fun_bind(struct fun_dev *fdev, enum fun_admin_bind_type type0,
	     unsigned int id0, enum fun_admin_bind_type type1,
	     unsigned int id1);

int fun_submit_admin_cmd(struct fun_dev *fdev, struct fun_admin_req_common *cmd,
			 fun_admin_callback_t cb, void *cb_data, bool wait_ok);
int fun_submit_admin_sync_cmd(struct fun_dev *fdev,
			      struct fun_admin_req_common *cmd, void *rsp,
			      size_t rspsize, unsigned int timeout);

int fun_dev_enable(struct fun_dev *fdev, struct pci_dev *pdev,
		   const struct fun_dev_params *areq, const char *name);
void fun_dev_disable(struct fun_dev *fdev);

int fun_reserve_irqs(struct fun_dev *fdev, unsigned int nirqs,
		     u16 *irq_indices);
void fun_release_irqs(struct fun_dev *fdev, unsigned int nirqs,
		      u16 *irq_indices);

void fun_serv_stop(struct fun_dev *fd);
void fun_serv_restart(struct fun_dev *fd);
void fun_serv_sched(struct fun_dev *fd);

#endif /* _FUNDEV_H */