#ifndef BCM_VK_H
#define BCM_VK_H
#include <linux/atomic.h>
#include <linux/firmware.h>
#include <linux/irq.h>
#include <linux/kref.h>
#include <linux/miscdevice.h>
#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/poll.h>
#include <linux/sched/signal.h>
#include <linux/tty.h>
#include <linux/uaccess.h>
#include <uapi/linux/misc/bcm_vk.h>
#include "bcm_vk_msg.h"
#define DRV_MODULE_NAME …
#define BAR_CODEPUSH_SBL …
#define CODEPUSH_BOOT1_ENTRY …
#define CODEPUSH_MASK …
#define CODEPUSH_BOOTSTART …
#define BAR_BOOT_STATUS …
#define SRAM_OPEN …
#define DDR_OPEN …
#define FW_LOADER_ACK_SEND_MORE_DATA …
#define FW_LOADER_ACK_IN_PROGRESS …
#define FW_LOADER_ACK_RCVD_ALL_DATA …
#define BOOT_STDALONE_RUNNING …
#define BOOT_STATE_MASK …
#define BOOT_ERR_SHIFT …
#define BOOT_ERR_MASK …
#define BOOT_PROG_MASK …
#define BROM_STATUS_NOT_RUN …
#define BROM_NOT_RUN …
#define BROM_STATUS_COMPLETE …
#define BROM_RUNNING …
#define BOOT1_STATUS_COMPLETE …
#define BOOT1_RUNNING …
#define BOOT2_STATUS_COMPLETE …
#define BOOT2_RUNNING …
#define BAR_CODEPUSH_SBI …
#define CODEPUSH_BOOT2_ENTRY …
#define BAR_CARD_STATUS …
#define CARD_STATUS_TTYVK0_READY …
#define CARD_STATUS_TTYVK1_READY …
#define BAR_BOOT1_STDALONE_PROGRESS …
#define BOOT1_STDALONE_SUCCESS …
#define BOOT1_STDALONE_PROGRESS_MASK …
#define BAR_METADATA_VERSION …
#define BAR_OS_UPTIME …
#define BAR_CHIP_ID …
#define MAJOR_SOC_REV(_chip_id) …
#define BAR_CARD_TEMPERATURE …
#define BCM_VK_TEMP_FIELD_MASK …
#define BCM_VK_CPU_TEMP_SHIFT …
#define BCM_VK_DDR0_TEMP_SHIFT …
#define BCM_VK_DDR1_TEMP_SHIFT …
#define BAR_CARD_VOLTAGE …
#define BCM_VK_VOLT_RAIL_MASK …
#define BCM_VK_3P3_VOLT_REG_SHIFT …
#define BAR_CARD_ERR_LOG …
#define ERR_LOG_UECC …
#define ERR_LOG_SSIM_BUSY …
#define ERR_LOG_AFBC_BUSY …
#define ERR_LOG_HIGH_TEMP_ERR …
#define ERR_LOG_WDOG_TIMEOUT …
#define ERR_LOG_SYS_FAULT …
#define ERR_LOG_RAMDUMP …
#define ERR_LOG_COP_WDOG_TIMEOUT …
#define ERR_LOG_MEM_ALLOC_FAIL …
#define ERR_LOG_LOW_TEMP_WARN …
#define ERR_LOG_ECC …
#define ERR_LOG_IPC_DWN …
#define ERR_LOG_HOST_INTF_V_FAIL …
#define ERR_LOG_HOST_HB_FAIL …
#define ERR_LOG_HOST_PCIE_DWN …
#define BAR_CARD_ERR_MEM …
#define BCM_VK_MEM_ERR_FIELD_MASK …
#define BCM_VK_ECC_MEM_ERR_SHIFT …
#define BCM_VK_UECC_MEM_ERR_SHIFT …
#define BCM_VK_ECC_THRESHOLD …
#define BCM_VK_UECC_THRESHOLD …
#define BAR_CARD_PWR_AND_THRE …
#define BCM_VK_PWR_AND_THRE_FIELD_MASK …
#define BCM_VK_LOW_TEMP_THRE_SHIFT …
#define BCM_VK_HIGH_TEMP_THRE_SHIFT …
#define BCM_VK_PWR_STATE_SHIFT …
#define BAR_CARD_STATIC_INFO …
#define BAR_INTF_VER …
#define BAR_INTF_VER_MAJOR_SHIFT …
#define BAR_INTF_VER_MASK …
#define SEMANTIC_MAJOR …
#define SEMANTIC_MINOR …
#define VK_BAR0_REGSEG_DB_BASE …
#define VK_BAR0_REGSEG_DB_REG_GAP …
#define VK_BAR0_RESET_DB_NUM …
#define VK_BAR0_RESET_DB_SOFT …
#define VK_BAR0_RESET_DB_HARD …
#define VK_BAR0_RESET_RAMPDUMP …
#define VK_BAR0_Q_DB_BASE(q_num) …
#define VK_BAR0_RESET_DB_BASE …
#define BAR_BOOTSRC_SELECT …
#define BOOTSRC_SOFT_ENABLE …
#define BAR_FIRMWARE_TAG_SIZE …
#define FIRMWARE_STATUS_PRE_INIT_DONE …
#define VK_MSG_ID_BITMAP_SIZE …
#define VK_MSG_ID_BITMAP_MASK …
#define VK_MSG_ID_OVERFLOW …
#define VK_BAR1_MSGQ_DEF_RDY …
#define VK_BAR1_MSGQ_RDY_MARKER …
#define VK_BAR1_DIAG_RDY_MARKER …
#define VK_BAR1_MSGQ_NR …
#define VK_BAR1_MSGQ_CTRL_OFF …
#define VK_BAR1_UCODE_VER_TAG …
#define VK_BAR1_BOOT1_VER_TAG …
#define VK_BAR1_VER_TAG_SIZE …
#define VK_BAR1_DMA_BUF_OFF_HI …
#define VK_BAR1_DMA_BUF_OFF_LO …
#define VK_BAR1_DMA_BUF_SZ …
#define VK_BAR1_SCRATCH_OFF_HI …
#define VK_BAR1_SCRATCH_OFF_LO …
#define VK_BAR1_SCRATCH_SZ_ADDR …
#define VK_BAR1_SCRATCH_DEF_NR_PAGES …
#define VK_BAR1_DAUTH_BASE_ADDR …
#define VK_BAR1_DAUTH_STORE_SIZE …
#define VK_BAR1_DAUTH_VALID_SIZE …
#define VK_BAR1_DAUTH_MAX …
#define VK_BAR1_DAUTH_STORE_ADDR(x) …
#define VK_BAR1_DAUTH_VALID_ADDR(x) …
#define VK_BAR1_SOTP_REVID_BASE_ADDR …
#define VK_BAR1_SOTP_REVID_SIZE …
#define VK_BAR1_SOTP_REVID_MAX …
#define VK_BAR1_SOTP_REVID_ADDR(x) …
#define MAX_BAR …
#define BCM_VK_DEF_IB_SGL_BLK_LEN …
#define BCM_VK_IB_SGL_BLK_MAX …
enum pci_barno { … };
#ifdef CONFIG_BCM_VK_TTY
#define BCM_VK_NUM_TTY …
#else
#define BCM_VK_NUM_TTY …
#endif
struct bcm_vk_tty { … };
#define MAX_OPP …
#define MAX_CARD_INFO_TAG_SIZE …
struct bcm_vk_card_info { … };
struct bcm_vk_dauth_key { … };
struct bcm_vk_dauth_info { … };
struct bcm_vk_peer_log { … };
#define BCM_VK_PEER_LOG_BUF_MAX …
#define BCM_VK_PEER_LOG_LINE_MAX …
#define BCM_VK_PROC_TYPE_TAG_LEN …
struct bcm_vk_proc_mon_entry_t { … };
#define BCM_VK_PROC_MON_MAX …
struct bcm_vk_proc_mon_info { … };
struct bcm_vk_hb_ctrl { … };
struct bcm_vk_alert { … };
struct bcm_vk_alert_cnts { … };
struct bcm_vk { … };
enum bcm_vk_wq_offload_flags { … };
#define BCM_VK_EXTRACT_FIELD(_field, _reg, _mask, _shift) …
struct bcm_vk_entry { … };
#define BCM_VK_PEER_ERR_NUM …
extern struct bcm_vk_entry const bcm_vk_peer_err[BCM_VK_PEER_ERR_NUM];
#define BCM_VK_HOST_ERR_NUM …
extern struct bcm_vk_entry const bcm_vk_host_err[BCM_VK_HOST_ERR_NUM];
#define BCM_VK_INTF_IS_DOWN(val) …
static inline u32 vkread32(struct bcm_vk *vk, enum pci_barno bar, u64 offset)
{ … }
static inline void vkwrite32(struct bcm_vk *vk,
u32 value,
enum pci_barno bar,
u64 offset)
{ … }
static inline u8 vkread8(struct bcm_vk *vk, enum pci_barno bar, u64 offset)
{ … }
static inline void vkwrite8(struct bcm_vk *vk,
u8 value,
enum pci_barno bar,
u64 offset)
{ … }
static inline bool bcm_vk_msgq_marker_valid(struct bcm_vk *vk)
{ … }
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);
void bcm_vk_release_data(struct kref *kref);
irqreturn_t bcm_vk_msgq_irqhandler(int irq, void *dev_id);
irqreturn_t bcm_vk_notf_irqhandler(int irq, void *dev_id);
irqreturn_t bcm_vk_tty_irqhandler(int irq, void *dev_id);
int bcm_vk_msg_init(struct bcm_vk *vk);
void bcm_vk_msg_remove(struct bcm_vk *vk);
void bcm_vk_drain_msg_on_reset(struct bcm_vk *vk);
int bcm_vk_sync_msgq(struct bcm_vk *vk, bool force_sync);
void bcm_vk_blk_drv_access(struct bcm_vk *vk);
s32 bcm_to_h_msg_dequeue(struct bcm_vk *vk);
int bcm_vk_send_shutdown_msg(struct bcm_vk *vk, u32 shut_type,
const pid_t pid, const u32 q_num);
void bcm_to_v_q_doorbell(struct bcm_vk *vk, u32 q_num, u32 db_val);
int bcm_vk_auto_load_all_images(struct bcm_vk *vk);
void bcm_vk_hb_init(struct bcm_vk *vk);
void bcm_vk_hb_deinit(struct bcm_vk *vk);
void bcm_vk_handle_notf(struct bcm_vk *vk);
bool bcm_vk_drv_access_ok(struct bcm_vk *vk);
void bcm_vk_set_host_alert(struct bcm_vk *vk, u32 bit_mask);
#ifdef CONFIG_BCM_VK_TTY
int bcm_vk_tty_init(struct bcm_vk *vk, char *name);
void bcm_vk_tty_exit(struct bcm_vk *vk);
void bcm_vk_tty_terminate_tty_user(struct bcm_vk *vk);
void bcm_vk_tty_wq_exit(struct bcm_vk *vk);
static inline void bcm_vk_tty_set_irq_enabled(struct bcm_vk *vk, int index)
{ … }
#else
static inline int bcm_vk_tty_init(struct bcm_vk *vk, char *name)
{
return 0;
}
static inline void bcm_vk_tty_exit(struct bcm_vk *vk)
{
}
static inline void bcm_vk_tty_terminate_tty_user(struct bcm_vk *vk)
{
}
static inline void bcm_vk_tty_wq_exit(struct bcm_vk *vk)
{
}
static inline void bcm_vk_tty_set_irq_enabled(struct bcm_vk *vk, int index)
{
}
#endif
#endif