#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/property.h>
#include <linux/string_helpers.h>
#include "nhi.h"
#include "nhi_regs.h"
#include "tb.h"
#define RING_TYPE(ring) …
#define RING_FIRST_USABLE_HOPID …
#define RING_E2E_RESERVED_HOPID …
#define MSIX_MIN_VECS …
#define MSIX_MAX_VECS …
#define NHI_MAILBOX_TIMEOUT …
#define QUIRK_AUTO_CLEAR_INT …
#define QUIRK_E2E …
static bool host_reset = …;
module_param(host_reset, bool, 0444);
MODULE_PARM_DESC(…) …;
static int ring_interrupt_index(const struct tb_ring *ring)
{ … }
static void nhi_mask_interrupt(struct tb_nhi *nhi, int mask, int ring)
{ … }
static void nhi_clear_interrupt(struct tb_nhi *nhi, int ring)
{ … }
static void ring_interrupt_active(struct tb_ring *ring, bool active)
{ … }
static void nhi_disable_interrupts(struct tb_nhi *nhi)
{ … }
static void __iomem *ring_desc_base(struct tb_ring *ring)
{ … }
static void __iomem *ring_options_base(struct tb_ring *ring)
{ … }
static void ring_iowrite_cons(struct tb_ring *ring, u16 cons)
{ … }
static void ring_iowrite_prod(struct tb_ring *ring, u16 prod)
{ … }
static void ring_iowrite32desc(struct tb_ring *ring, u32 value, u32 offset)
{ … }
static void ring_iowrite64desc(struct tb_ring *ring, u64 value, u32 offset)
{ … }
static void ring_iowrite32options(struct tb_ring *ring, u32 value, u32 offset)
{ … }
static bool ring_full(struct tb_ring *ring)
{ … }
static bool ring_empty(struct tb_ring *ring)
{ … }
static void ring_write_descriptors(struct tb_ring *ring)
{ … }
static void ring_work(struct work_struct *work)
{ … }
int __tb_ring_enqueue(struct tb_ring *ring, struct ring_frame *frame)
{ … }
EXPORT_SYMBOL_GPL(…);
struct ring_frame *tb_ring_poll(struct tb_ring *ring)
{ … }
EXPORT_SYMBOL_GPL(…);
static void __ring_interrupt_mask(struct tb_ring *ring, bool mask)
{ … }
static void __ring_interrupt(struct tb_ring *ring)
{ … }
void tb_ring_poll_complete(struct tb_ring *ring)
{ … }
EXPORT_SYMBOL_GPL(…);
static void ring_clear_msix(const struct tb_ring *ring)
{ … }
static irqreturn_t ring_msix(int irq, void *data)
{ … }
static int ring_request_msix(struct tb_ring *ring, bool no_suspend)
{ … }
static void ring_release_msix(struct tb_ring *ring)
{ … }
static int nhi_alloc_hop(struct tb_nhi *nhi, struct tb_ring *ring)
{ … }
static struct tb_ring *tb_ring_alloc(struct tb_nhi *nhi, u32 hop, int size,
bool transmit, unsigned int flags,
int e2e_tx_hop, u16 sof_mask, u16 eof_mask,
void (*start_poll)(void *),
void *poll_data)
{ … }
struct tb_ring *tb_ring_alloc_tx(struct tb_nhi *nhi, int hop, int size,
unsigned int flags)
{ … }
EXPORT_SYMBOL_GPL(…);
struct tb_ring *tb_ring_alloc_rx(struct tb_nhi *nhi, int hop, int size,
unsigned int flags, int e2e_tx_hop,
u16 sof_mask, u16 eof_mask,
void (*start_poll)(void *), void *poll_data)
{ … }
EXPORT_SYMBOL_GPL(…);
void tb_ring_start(struct tb_ring *ring)
{ … }
EXPORT_SYMBOL_GPL(…);
void tb_ring_stop(struct tb_ring *ring)
{ … }
EXPORT_SYMBOL_GPL(…);
void tb_ring_free(struct tb_ring *ring)
{ … }
EXPORT_SYMBOL_GPL(…);
int nhi_mailbox_cmd(struct tb_nhi *nhi, enum nhi_mailbox_cmd cmd, u32 data)
{ … }
enum nhi_fw_mode nhi_mailbox_mode(struct tb_nhi *nhi)
{ … }
static void nhi_interrupt_work(struct work_struct *work)
{ … }
static irqreturn_t nhi_msi(int irq, void *data)
{ … }
static int __nhi_suspend_noirq(struct device *dev, bool wakeup)
{ … }
static int nhi_suspend_noirq(struct device *dev)
{ … }
static int nhi_freeze_noirq(struct device *dev)
{ … }
static int nhi_thaw_noirq(struct device *dev)
{ … }
static bool nhi_wake_supported(struct pci_dev *pdev)
{ … }
static int nhi_poweroff_noirq(struct device *dev)
{ … }
static void nhi_enable_int_throttling(struct tb_nhi *nhi)
{ … }
static int nhi_resume_noirq(struct device *dev)
{ … }
static int nhi_suspend(struct device *dev)
{ … }
static void nhi_complete(struct device *dev)
{ … }
static int nhi_runtime_suspend(struct device *dev)
{ … }
static int nhi_runtime_resume(struct device *dev)
{ … }
static void nhi_shutdown(struct tb_nhi *nhi)
{ … }
static void nhi_check_quirks(struct tb_nhi *nhi)
{ … }
static int nhi_check_iommu_pdev(struct pci_dev *pdev, void *data)
{ … }
static void nhi_check_iommu(struct tb_nhi *nhi)
{ … }
static void nhi_reset(struct tb_nhi *nhi)
{ … }
static int nhi_init_msi(struct tb_nhi *nhi)
{ … }
static bool nhi_imr_valid(struct pci_dev *pdev)
{ … }
static struct tb *nhi_select_cm(struct tb_nhi *nhi)
{ … }
static int nhi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{ … }
static void nhi_remove(struct pci_dev *pdev)
{ … }
static const struct dev_pm_ops nhi_pm_ops = …;
static struct pci_device_id nhi_ids[] = …;
MODULE_DEVICE_TABLE(pci, nhi_ids);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static struct pci_driver nhi_driver = …;
static int __init nhi_init(void)
{ … }
static void __exit nhi_unload(void)
{ … }
rootfs_initcall(nhi_init);
module_exit(nhi_unload);