#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/firmware.h>
#include <linux/fs.h>
#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/panic_notifier.h>
#include <linux/kref.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/pci_regs.h>
#include <uapi/linux/misc/bcm_vk.h>
#include "bcm_vk.h"
#define PCI_DEVICE_ID_VALKYRIE …
#define PCI_DEVICE_ID_VIPER …
static DEFINE_IDA(bcm_vk_ida);
enum soc_idx { … };
enum img_idx { … };
struct load_image_entry { … };
#define NUM_BOOT_STAGES …
static const struct load_image_entry image_tab[][NUM_BOOT_STAGES] = …;
#define BAR1_CODEPUSH_BASE_BOOT1 …
#define LOAD_IMAGE_TIMEOUT_MS …
#define BOOT1_STARTUP_TIMEOUT_MS …
#define BOOT2_STARTUP_TIMEOUT_MS …
#define TXFR_COMPLETE_TIMEOUT_MS …
#define VK_MSIX_MSGQ_MAX …
#define VK_MSIX_NOTF_MAX …
#define VK_MSIX_TTY_MAX …
#define VK_MSIX_IRQ_MAX …
#define VK_MSIX_IRQ_MIN_REQ …
#define BCM_VK_DMA_BITS …
#define BCM_VK_UCODE_BOOT_US …
#define BCM_VK_UCODE_BOOT_MAX_US …
#define BCM_VK_DEINIT_TIME_MS …
static bool auto_load = …;
module_param(auto_load, bool, 0444);
MODULE_PARM_DESC(…) …;
static uint nr_scratch_pages = …;
module_param(nr_scratch_pages, uint, 0444);
MODULE_PARM_DESC(…) …;
static uint nr_ib_sgl_blk = …;
module_param(nr_ib_sgl_blk, uint, 0444);
MODULE_PARM_DESC(…) …;
const struct bcm_vk_entry bcm_vk_peer_err[BCM_VK_PEER_ERR_NUM] = …;
const struct bcm_vk_entry bcm_vk_host_err[BCM_VK_HOST_ERR_NUM] = …;
irqreturn_t bcm_vk_notf_irqhandler(int irq, void *dev_id)
{ … }
static int bcm_vk_intf_ver_chk(struct bcm_vk *vk)
{ … }
static void bcm_vk_log_notf(struct bcm_vk *vk,
struct bcm_vk_alert *alert,
struct bcm_vk_entry const *entry_tab,
const u32 table_size)
{ … }
static void bcm_vk_dump_peer_log(struct bcm_vk *vk)
{ … }
void bcm_vk_handle_notf(struct bcm_vk *vk)
{ … }
static inline int bcm_vk_wait(struct bcm_vk *vk, enum pci_barno bar,
u64 offset, u32 mask, u32 value,
unsigned long timeout_ms)
{ … }
static void bcm_vk_get_card_info(struct bcm_vk *vk)
{ … }
static void bcm_vk_get_proc_mon_info(struct bcm_vk *vk)
{ … }
static int bcm_vk_sync_card_info(struct bcm_vk *vk)
{ … }
void bcm_vk_blk_drv_access(struct bcm_vk *vk)
{ … }
static void bcm_vk_buf_notify(struct bcm_vk *vk, void *bufp,
dma_addr_t host_buf_addr, u32 buf_size)
{ … }
static int bcm_vk_load_image_by_type(struct bcm_vk *vk, u32 load_type,
const char *filename)
{ … }
static u32 bcm_vk_next_boot_image(struct bcm_vk *vk)
{ … }
static enum soc_idx get_soc_idx(struct bcm_vk *vk)
{ … }
static const char *get_load_fw_name(struct bcm_vk *vk,
const struct load_image_entry *entry)
{ … }
int bcm_vk_auto_load_all_images(struct bcm_vk *vk)
{ … }
static int bcm_vk_trigger_autoload(struct bcm_vk *vk)
{ … }
static void bcm_vk_wq_handler(struct work_struct *work)
{ … }
static long bcm_vk_load_image(struct bcm_vk *vk,
const struct vk_image __user *arg)
{ … }
static int bcm_vk_reset_successful(struct bcm_vk *vk)
{ … }
static void bcm_to_v_reset_doorbell(struct bcm_vk *vk, u32 db_val)
{ … }
static int bcm_vk_trigger_reset(struct bcm_vk *vk)
{ … }
static long bcm_vk_reset(struct bcm_vk *vk, struct vk_reset __user *arg)
{ … }
static int bcm_vk_mmap(struct file *file, struct vm_area_struct *vma)
{ … }
static long bcm_vk_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
static const struct file_operations bcm_vk_fops = …;
static int bcm_vk_on_panic(struct notifier_block *nb,
unsigned long e, void *p)
{ … }
static int bcm_vk_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ … }
void bcm_vk_release_data(struct kref *kref)
{ … }
static void bcm_vk_remove(struct pci_dev *pdev)
{ … }
static void bcm_vk_shutdown(struct pci_dev *pdev)
{ … }
static const struct pci_device_id bcm_vk_ids[] = …;
MODULE_DEVICE_TABLE(pci, bcm_vk_ids);
static struct pci_driver pci_driver = …;
module_pci_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_VERSION(…) …;