#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/hash.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/sizes.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include "bcm_vk.h"
#include "bcm_vk_msg.h"
#include "bcm_vk_sg.h"
#define BCM_VK_MSG_Q_SHIFT …
#define BCM_VK_MSG_Q_MASK …
#define BCM_VK_MSG_ID_MASK …
#define BCM_VK_DMA_DRAIN_MAX_MS …
#define BCM_VK_MSG_PROC_MAX_LOOP …
static bool hb_mon = …;
module_param(hb_mon, bool, 0444);
MODULE_PARM_DESC(…) …;
static int batch_log = …;
module_param(batch_log, int, 0444);
MODULE_PARM_DESC(…) …;
static bool hb_mon_is_on(void)
{ … }
static u32 get_q_num(const struct vk_msg_blk *msg)
{ … }
static void set_q_num(struct vk_msg_blk *msg, u32 q_num)
{ … }
static u32 get_msg_id(const struct vk_msg_blk *msg)
{ … }
static void set_msg_id(struct vk_msg_blk *msg, u32 val)
{ … }
static u32 msgq_inc(const struct bcm_vk_sync_qinfo *qinfo, u32 idx, u32 inc)
{ … }
static
struct vk_msg_blk __iomem *msgq_blk_addr(const struct bcm_vk_sync_qinfo *qinfo,
u32 idx)
{ … }
static u32 msgq_occupied(const struct bcm_vk_msgq __iomem *msgq,
const struct bcm_vk_sync_qinfo *qinfo)
{ … }
static
u32 msgq_avail_space(const struct bcm_vk_msgq __iomem *msgq,
const struct bcm_vk_sync_qinfo *qinfo)
{ … }
#define BCM_VK_H2VK_ENQ_RETRY …
#define BCM_VK_H2VK_ENQ_RETRY_DELAY_MS …
bool bcm_vk_drv_access_ok(struct bcm_vk *vk)
{ … }
void bcm_vk_set_host_alert(struct bcm_vk *vk, u32 bit_mask)
{ … }
#define BCM_VK_HB_TIMER_S …
#define BCM_VK_HB_TIMER_VALUE …
#define BCM_VK_HB_LOST_MAX …
static void bcm_vk_hb_poll(struct work_struct *work)
{ … }
void bcm_vk_hb_init(struct bcm_vk *vk)
{ … }
void bcm_vk_hb_deinit(struct bcm_vk *vk)
{ … }
static void bcm_vk_msgid_bitmap_clear(struct bcm_vk *vk,
unsigned int start,
unsigned int nbits)
{ … }
static struct bcm_vk_ctx *bcm_vk_get_ctx(struct bcm_vk *vk, const pid_t pid)
{ … }
static u16 bcm_vk_get_msg_id(struct bcm_vk *vk)
{ … }
static int bcm_vk_free_ctx(struct bcm_vk *vk, struct bcm_vk_ctx *ctx)
{ … }
static void bcm_vk_free_wkent(struct device *dev, struct bcm_vk_wkent *entry)
{ … }
static void bcm_vk_drain_all_pend(struct device *dev,
struct bcm_vk_msg_chan *chan,
struct bcm_vk_ctx *ctx)
{ … }
void bcm_vk_drain_msg_on_reset(struct bcm_vk *vk)
{ … }
int bcm_vk_sync_msgq(struct bcm_vk *vk, bool force_sync)
{ … }
static int bcm_vk_msg_chan_init(struct bcm_vk_msg_chan *chan)
{ … }
static void bcm_vk_append_pendq(struct bcm_vk_msg_chan *chan, u16 q_num,
struct bcm_vk_wkent *entry)
{ … }
static u32 bcm_vk_append_ib_sgl(struct bcm_vk *vk,
struct bcm_vk_wkent *entry,
struct _vk_data *data,
unsigned int num_planes)
{ … }
void bcm_to_v_q_doorbell(struct bcm_vk *vk, u32 q_num, u32 db_val)
{ … }
static int bcm_to_v_msg_enqueue(struct bcm_vk *vk, struct bcm_vk_wkent *entry)
{ … }
int bcm_vk_send_shutdown_msg(struct bcm_vk *vk, u32 shut_type,
const pid_t pid, const u32 q_num)
{ … }
static int bcm_vk_handle_last_sess(struct bcm_vk *vk, const pid_t pid,
const u32 q_num)
{ … }
static struct bcm_vk_wkent *bcm_vk_dequeue_pending(struct bcm_vk *vk,
struct bcm_vk_msg_chan *chan,
u16 q_num,
u16 msg_id)
{ … }
s32 bcm_to_h_msg_dequeue(struct bcm_vk *vk)
{ … }
static int bcm_vk_data_init(struct bcm_vk *vk)
{ … }
irqreturn_t bcm_vk_msgq_irqhandler(int irq, void *dev_id)
{ … }
int bcm_vk_open(struct inode *inode, struct file *p_file)
{ … }
ssize_t bcm_vk_read(struct file *p_file,
char __user *buf,
size_t count,
loff_t *f_pos)
{ … }
ssize_t bcm_vk_write(struct file *p_file,
const char __user *buf,
size_t count,
loff_t *f_pos)
{ … }
__poll_t bcm_vk_poll(struct file *p_file, struct poll_table_struct *wait)
{ … }
int bcm_vk_release(struct inode *inode, struct file *p_file)
{ … }
int bcm_vk_msg_init(struct bcm_vk *vk)
{ … }
void bcm_vk_msg_remove(struct bcm_vk *vk)
{ … }