#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/random.h>
#include <linux/slab.h>
#include <linux/ntb.h>
#include "ntb_hw_intel.h"
#include "ntb_hw_gen1.h"
#include "ntb_hw_gen3.h"
#include "ntb_hw_gen4.h"
#define NTB_NAME …
#define NTB_DESC …
#define NTB_VER …
MODULE_DESCRIPTION(…);
MODULE_VERSION(…);
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
#define bar0_off(base, bar) …
#define bar2_off(base, bar) …
static const struct intel_ntb_reg xeon_reg;
static const struct intel_ntb_alt_reg xeon_pri_reg;
static const struct intel_ntb_alt_reg xeon_sec_reg;
static const struct intel_ntb_alt_reg xeon_b2b_reg;
static const struct intel_ntb_xlat_reg xeon_pri_xlat;
static const struct intel_ntb_xlat_reg xeon_sec_xlat;
static const struct ntb_dev_ops intel_ntb_ops;
static const struct file_operations intel_ntb_debugfs_info;
static struct dentry *debugfs_dir;
static int b2b_mw_idx = …;
module_param(b2b_mw_idx, int, 0644);
MODULE_PARM_DESC(…) …;
static unsigned int b2b_mw_share;
module_param(b2b_mw_share, uint, 0644);
MODULE_PARM_DESC(…) …;
module_param_named(xeon_b2b_usd_bar2_addr64,
xeon_b2b_usd_addr.bar2_addr64, ullong, 0644);
MODULE_PARM_DESC(…) …;
module_param_named(xeon_b2b_usd_bar4_addr64,
xeon_b2b_usd_addr.bar4_addr64, ullong, 0644);
MODULE_PARM_DESC(…) …;
module_param_named(xeon_b2b_usd_bar4_addr32,
xeon_b2b_usd_addr.bar4_addr32, ullong, 0644);
MODULE_PARM_DESC(…) …;
module_param_named(xeon_b2b_usd_bar5_addr32,
xeon_b2b_usd_addr.bar5_addr32, ullong, 0644);
MODULE_PARM_DESC(…) …;
module_param_named(xeon_b2b_dsd_bar2_addr64,
xeon_b2b_dsd_addr.bar2_addr64, ullong, 0644);
MODULE_PARM_DESC(…) …;
module_param_named(xeon_b2b_dsd_bar4_addr64,
xeon_b2b_dsd_addr.bar4_addr64, ullong, 0644);
MODULE_PARM_DESC(…) …;
module_param_named(xeon_b2b_dsd_bar4_addr32,
xeon_b2b_dsd_addr.bar4_addr32, ullong, 0644);
MODULE_PARM_DESC(…) …;
module_param_named(xeon_b2b_dsd_bar5_addr32,
xeon_b2b_dsd_addr.bar5_addr32, ullong, 0644);
MODULE_PARM_DESC(…) …;
static int xeon_init_isr(struct intel_ntb_dev *ndev);
static inline void ndev_reset_unsafe_flags(struct intel_ntb_dev *ndev)
{ … }
static inline int ndev_is_unsafe(struct intel_ntb_dev *ndev,
unsigned long flag)
{ … }
static inline int ndev_ignore_unsafe(struct intel_ntb_dev *ndev,
unsigned long flag)
{ … }
int ndev_mw_to_bar(struct intel_ntb_dev *ndev, int idx)
{ … }
void ndev_db_addr(struct intel_ntb_dev *ndev,
phys_addr_t *db_addr, resource_size_t *db_size,
phys_addr_t reg_addr, unsigned long reg)
{ … }
u64 ndev_db_read(struct intel_ntb_dev *ndev,
void __iomem *mmio)
{ … }
int ndev_db_write(struct intel_ntb_dev *ndev, u64 db_bits,
void __iomem *mmio)
{ … }
static inline int ndev_db_set_mask(struct intel_ntb_dev *ndev, u64 db_bits,
void __iomem *mmio)
{ … }
static inline int ndev_db_clear_mask(struct intel_ntb_dev *ndev, u64 db_bits,
void __iomem *mmio)
{ … }
static inline u64 ndev_vec_mask(struct intel_ntb_dev *ndev, int db_vector)
{ … }
static inline int ndev_spad_addr(struct intel_ntb_dev *ndev, int idx,
phys_addr_t *spad_addr, phys_addr_t reg_addr,
unsigned long reg)
{ … }
static inline u32 ndev_spad_read(struct intel_ntb_dev *ndev, int idx,
void __iomem *mmio)
{ … }
static inline int ndev_spad_write(struct intel_ntb_dev *ndev, int idx, u32 val,
void __iomem *mmio)
{ … }
static irqreturn_t ndev_interrupt(struct intel_ntb_dev *ndev, int vec)
{ … }
static irqreturn_t ndev_vec_isr(int irq, void *dev)
{ … }
static irqreturn_t ndev_irq_isr(int irq, void *dev)
{ … }
int ndev_init_isr(struct intel_ntb_dev *ndev,
int msix_min, int msix_max,
int msix_shift, int total_shift)
{ … }
static void ndev_deinit_isr(struct intel_ntb_dev *ndev)
{ … }
static ssize_t ndev_ntb_debugfs_read(struct file *filp, char __user *ubuf,
size_t count, loff_t *offp)
{ … }
static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
size_t count, loff_t *offp)
{ … }
static void ndev_init_debugfs(struct intel_ntb_dev *ndev)
{ … }
static void ndev_deinit_debugfs(struct intel_ntb_dev *ndev)
{ … }
int intel_ntb_mw_count(struct ntb_dev *ntb, int pidx)
{ … }
int intel_ntb_mw_get_align(struct ntb_dev *ntb, int pidx, int idx,
resource_size_t *addr_align,
resource_size_t *size_align,
resource_size_t *size_max)
{ … }
static int intel_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int idx,
dma_addr_t addr, resource_size_t size)
{ … }
u64 intel_ntb_link_is_up(struct ntb_dev *ntb, enum ntb_speed *speed,
enum ntb_width *width)
{ … }
static int intel_ntb_link_enable(struct ntb_dev *ntb,
enum ntb_speed max_speed,
enum ntb_width max_width)
{ … }
int intel_ntb_link_disable(struct ntb_dev *ntb)
{ … }
int intel_ntb_peer_mw_count(struct ntb_dev *ntb)
{ … }
int intel_ntb_peer_mw_get_addr(struct ntb_dev *ntb, int idx,
phys_addr_t *base, resource_size_t *size)
{ … }
static int intel_ntb_db_is_unsafe(struct ntb_dev *ntb)
{ … }
u64 intel_ntb_db_valid_mask(struct ntb_dev *ntb)
{ … }
int intel_ntb_db_vector_count(struct ntb_dev *ntb)
{ … }
u64 intel_ntb_db_vector_mask(struct ntb_dev *ntb, int db_vector)
{ … }
static u64 intel_ntb_db_read(struct ntb_dev *ntb)
{ … }
static int intel_ntb_db_clear(struct ntb_dev *ntb, u64 db_bits)
{ … }
int intel_ntb_db_set_mask(struct ntb_dev *ntb, u64 db_bits)
{ … }
int intel_ntb_db_clear_mask(struct ntb_dev *ntb, u64 db_bits)
{ … }
static int intel_ntb_peer_db_addr(struct ntb_dev *ntb, phys_addr_t *db_addr,
resource_size_t *db_size, u64 *db_data, int db_bit)
{ … }
static int intel_ntb_peer_db_set(struct ntb_dev *ntb, u64 db_bits)
{ … }
int intel_ntb_spad_is_unsafe(struct ntb_dev *ntb)
{ … }
int intel_ntb_spad_count(struct ntb_dev *ntb)
{ … }
u32 intel_ntb_spad_read(struct ntb_dev *ntb, int idx)
{ … }
int intel_ntb_spad_write(struct ntb_dev *ntb, int idx, u32 val)
{ … }
int intel_ntb_peer_spad_addr(struct ntb_dev *ntb, int pidx, int sidx,
phys_addr_t *spad_addr)
{ … }
u32 intel_ntb_peer_spad_read(struct ntb_dev *ntb, int pidx, int sidx)
{ … }
int intel_ntb_peer_spad_write(struct ntb_dev *ntb, int pidx, int sidx,
u32 val)
{ … }
static u64 xeon_db_ioread(const void __iomem *mmio)
{ … }
static void xeon_db_iowrite(u64 bits, void __iomem *mmio)
{ … }
static int xeon_poll_link(struct intel_ntb_dev *ndev)
{ … }
int xeon_link_is_up(struct intel_ntb_dev *ndev)
{ … }
enum ntb_topo xeon_ppd_topo(struct intel_ntb_dev *ndev, u8 ppd)
{ … }
static inline int xeon_ppd_bar4_split(struct intel_ntb_dev *ndev, u8 ppd)
{ … }
static int xeon_init_isr(struct intel_ntb_dev *ndev)
{ … }
static void xeon_deinit_isr(struct intel_ntb_dev *ndev)
{ … }
static int xeon_setup_b2b_mw(struct intel_ntb_dev *ndev,
const struct intel_b2b_addr *addr,
const struct intel_b2b_addr *peer_addr)
{ … }
static int xeon_init_ntb(struct intel_ntb_dev *ndev)
{ … }
static int xeon_init_dev(struct intel_ntb_dev *ndev)
{ … }
static void xeon_deinit_dev(struct intel_ntb_dev *ndev)
{ … }
static int intel_ntb_init_pci(struct intel_ntb_dev *ndev, struct pci_dev *pdev)
{ … }
static void intel_ntb_deinit_pci(struct intel_ntb_dev *ndev)
{ … }
static inline void ndev_init_struct(struct intel_ntb_dev *ndev,
struct pci_dev *pdev)
{ … }
static int intel_ntb_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{ … }
static void intel_ntb_pci_remove(struct pci_dev *pdev)
{ … }
static const struct intel_ntb_reg xeon_reg = …;
static const struct intel_ntb_alt_reg xeon_pri_reg = …;
static const struct intel_ntb_alt_reg xeon_sec_reg = …;
static const struct intel_ntb_alt_reg xeon_b2b_reg = …;
static const struct intel_ntb_xlat_reg xeon_pri_xlat = …;
static const struct intel_ntb_xlat_reg xeon_sec_xlat = …;
struct intel_b2b_addr xeon_b2b_usd_addr = …;
struct intel_b2b_addr xeon_b2b_dsd_addr = …;
static const struct ntb_dev_ops intel_ntb_ops = …;
static const struct file_operations intel_ntb_debugfs_info = …;
static const struct pci_device_id intel_ntb_pci_tbl[] = …;
MODULE_DEVICE_TABLE(pci, intel_ntb_pci_tbl);
static struct pci_driver intel_ntb_pci_driver = …;
static int __init intel_ntb_pci_driver_init(void)
{ … }
module_init(…) …;
static void __exit intel_ntb_pci_driver_exit(void)
{ … }
module_exit(intel_ntb_pci_driver_exit);