linux/drivers/pci/endpoint/functions/pci-epf-test.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Test driver to test endpoint functionality
 *
 * Copyright (C) 2017 Texas Instruments
 * Author: Kishon Vijay Abraham I <[email protected]>
 */

#include <linux/crc32.h>
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/pci_ids.h>
#include <linux/random.h>

#include <linux/pci-epc.h>
#include <linux/pci-epf.h>
#include <linux/pci_regs.h>

#define IRQ_TYPE_INTX
#define IRQ_TYPE_MSI
#define IRQ_TYPE_MSIX

#define COMMAND_RAISE_INTX_IRQ
#define COMMAND_RAISE_MSI_IRQ
#define COMMAND_RAISE_MSIX_IRQ
#define COMMAND_READ
#define COMMAND_WRITE
#define COMMAND_COPY

#define STATUS_READ_SUCCESS
#define STATUS_READ_FAIL
#define STATUS_WRITE_SUCCESS
#define STATUS_WRITE_FAIL
#define STATUS_COPY_SUCCESS
#define STATUS_COPY_FAIL
#define STATUS_IRQ_RAISED
#define STATUS_SRC_ADDR_INVALID
#define STATUS_DST_ADDR_INVALID

#define FLAG_USE_DMA

#define TIMER_RESOLUTION

static struct workqueue_struct *kpcitest_workqueue;

struct pci_epf_test {};

struct pci_epf_test_reg {} __packed;

static struct pci_epf_header test_header =;

static size_t bar_size[] =;

static void pci_epf_test_dma_callback(void *param)
{}

/**
 * pci_epf_test_data_transfer() - Function that uses dmaengine API to transfer
 *				  data between PCIe EP and remote PCIe RC
 * @epf_test: the EPF test device that performs the data transfer operation
 * @dma_dst: The destination address of the data transfer. It can be a physical
 *	     address given by pci_epc_mem_alloc_addr or DMA mapping APIs.
 * @dma_src: The source address of the data transfer. It can be a physical
 *	     address given by pci_epc_mem_alloc_addr or DMA mapping APIs.
 * @len: The size of the data transfer
 * @dma_remote: remote RC physical address
 * @dir: DMA transfer direction
 *
 * Function that uses dmaengine API to transfer data between PCIe EP and remote
 * PCIe RC. The source and destination address can be a physical address given
 * by pci_epc_mem_alloc_addr or the one obtained using DMA mapping APIs.
 *
 * The function returns '0' on success and negative value on failure.
 */
static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test,
				      dma_addr_t dma_dst, dma_addr_t dma_src,
				      size_t len, dma_addr_t dma_remote,
				      enum dma_transfer_direction dir)
{}

struct epf_dma_filter {};

static bool epf_dma_filter_fn(struct dma_chan *chan, void *node)
{}

/**
 * pci_epf_test_init_dma_chan() - Function to initialize EPF test DMA channel
 * @epf_test: the EPF test device that performs data transfer operation
 *
 * Function to initialize EPF test DMA channel.
 */
static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test)
{}

/**
 * pci_epf_test_clean_dma_chan() - Function to cleanup EPF test DMA channel
 * @epf_test: the EPF test device that performs data transfer operation
 *
 * Helper to cleanup EPF test DMA channel.
 */
static void pci_epf_test_clean_dma_chan(struct pci_epf_test *epf_test)
{}

static void pci_epf_test_print_rate(struct pci_epf_test *epf_test,
				    const char *op, u64 size,
				    struct timespec64 *start,
				    struct timespec64 *end, bool dma)
{}

static void pci_epf_test_copy(struct pci_epf_test *epf_test,
			      struct pci_epf_test_reg *reg)
{}

static void pci_epf_test_read(struct pci_epf_test *epf_test,
			      struct pci_epf_test_reg *reg)
{}

static void pci_epf_test_write(struct pci_epf_test *epf_test,
			       struct pci_epf_test_reg *reg)
{}

static void pci_epf_test_raise_irq(struct pci_epf_test *epf_test,
				   struct pci_epf_test_reg *reg)
{}

static void pci_epf_test_cmd_handler(struct work_struct *work)
{}

static int pci_epf_test_set_bar(struct pci_epf *epf)
{}

static void pci_epf_test_clear_bar(struct pci_epf *epf)
{}

static int pci_epf_test_epc_init(struct pci_epf *epf)
{}

static void pci_epf_test_epc_deinit(struct pci_epf *epf)
{}

static int pci_epf_test_link_up(struct pci_epf *epf)
{}

static int pci_epf_test_link_down(struct pci_epf *epf)
{}

static const struct pci_epc_event_ops pci_epf_test_event_ops =;

static int pci_epf_test_alloc_space(struct pci_epf *epf)
{}

static void pci_epf_test_free_space(struct pci_epf *epf)
{}

static int pci_epf_test_bind(struct pci_epf *epf)
{}

static void pci_epf_test_unbind(struct pci_epf *epf)
{}

static const struct pci_epf_device_id pci_epf_test_ids[] =;

static int pci_epf_test_probe(struct pci_epf *epf,
			      const struct pci_epf_device_id *id)
{}

static const struct pci_epf_ops ops =;

static struct pci_epf_driver test_driver =;

static int __init pci_epf_test_init(void)
{}
module_init();

static void __exit pci_epf_test_exit(void)
{}
module_exit(pci_epf_test_exit);

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();