linux/drivers/staging/vme_user/vme_fake.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Fake VME bridge support.
 *
 * This drive provides a fake VME bridge chip, this enables debugging of the
 * VME framework in the absence of a VME system.
 *
 * This driver has to do a number of things in software that would be driven
 * by hardware if it was available, it will also result in extra overhead at
 * times when compared with driving actual hardware.
 *
 * Author: Martyn Welch <[email protected]>
 * Copyright (c) 2014 Martyn Welch
 *
 * Based on vme_tsi148.c:
 *
 * Author: Martyn Welch <[email protected]>
 * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc.
 *
 * Based on work by Tom Armistead and Ajit Prem
 * Copyright 2004 Motorola Inc.
 */

#include <linux/device.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/types.h>

#include "vme.h"
#include "vme_bridge.h"

/*
 *  Define the number of each that the fake driver supports.
 */
#define FAKE_MAX_MASTER
#define FAKE_MAX_SLAVE

/* Structures to hold information normally held in device registers */
struct fake_slave_window {};

struct fake_master_window {};

/* Structure used to hold driver specific information */
struct fake_driver {};

/* Module parameter */
static int geoid;

static const char driver_name[] =;

static struct vme_bridge *exit_pointer;

static struct device *vme_root;

/*
 * Calling VME bus interrupt callback if provided.
 */
static void fake_VIRQ_tasklet(unsigned long data)
{}

/*
 * Configure VME interrupt
 */
static void fake_irq_set(struct vme_bridge *fake_bridge, int level,
			 int state, int sync)
{}

static void *fake_pci_to_ptr(dma_addr_t addr)
{}

static dma_addr_t fake_ptr_to_pci(void *addr)
{}

/*
 * Generate a VME bus interrupt at the requested level & vector. Wait for
 * interrupt to be acked.
 */
static int fake_irq_generate(struct vme_bridge *fake_bridge, int level,
			     int statid)
{}

/*
 * Initialize a slave window with the requested attributes.
 */
static int fake_slave_set(struct vme_slave_resource *image, int enabled,
			  unsigned long long vme_base, unsigned long long size,
			  dma_addr_t buf_base, u32 aspace, u32 cycle)
{}

/*
 * Get slave window configuration.
 */
static int fake_slave_get(struct vme_slave_resource *image, int *enabled,
			  unsigned long long *vme_base, unsigned long long *size,
			  dma_addr_t *buf_base, u32 *aspace, u32 *cycle)
{}

/*
 * Set the attributes of an outbound window.
 */
static int fake_master_set(struct vme_master_resource *image, int enabled,
			   unsigned long long vme_base, unsigned long long size,
			   u32 aspace, u32 cycle, u32 dwidth)
{}

/*
 * Set the attributes of an outbound window.
 */
static int __fake_master_get(struct vme_master_resource *image, int *enabled,
			     unsigned long long *vme_base, unsigned long long *size,
			     u32 *aspace, u32 *cycle, u32 *dwidth)
{}

static int fake_master_get(struct vme_master_resource *image, int *enabled,
			   unsigned long long *vme_base, unsigned long long *size,
			   u32 *aspace, u32 *cycle, u32 *dwidth)
{}

static void fake_lm_check(struct fake_driver *bridge, unsigned long long addr,
			  u32 aspace, u32 cycle)
{}

static noinline_for_stack u8 fake_vmeread8(struct fake_driver *bridge,
					   unsigned long long addr,
					   u32 aspace, u32 cycle)
{}

static noinline_for_stack u16 fake_vmeread16(struct fake_driver *bridge,
					     unsigned long long addr,
					     u32 aspace, u32 cycle)
{}

static noinline_for_stack u32 fake_vmeread32(struct fake_driver *bridge,
					     unsigned long long addr,
					     u32 aspace, u32 cycle)
{}

static ssize_t fake_master_read(struct vme_master_resource *image, void *buf,
				size_t count, loff_t offset)
{}

static noinline_for_stack void fake_vmewrite8(struct fake_driver *bridge,
					      u8 *buf, unsigned long long addr,
					      u32 aspace, u32 cycle)
{}

static noinline_for_stack void fake_vmewrite16(struct fake_driver *bridge,
					       u16 *buf, unsigned long long addr,
					       u32 aspace, u32 cycle)
{}

static noinline_for_stack void fake_vmewrite32(struct fake_driver *bridge,
					       u32 *buf, unsigned long long addr,
					       u32 aspace, u32 cycle)
{}

static ssize_t fake_master_write(struct vme_master_resource *image, void *buf,
				 size_t count, loff_t offset)
{}

/*
 * Perform an RMW cycle on the VME bus.
 *
 * Requires a previously configured master window, returns final value.
 */
static unsigned int fake_master_rmw(struct vme_master_resource *image,
				    unsigned int mask, unsigned int compare,
				    unsigned int swap, loff_t offset)
{}

/*
 * All 4 location monitors reside at the same base - this is therefore a
 * system wide configuration.
 *
 * This does not enable the LM monitor - that should be done when the first
 * callback is attached and disabled when the last callback is removed.
 */
static int fake_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
		       u32 aspace, u32 cycle)
{}

/* Get configuration of the callback monitor and return whether it is enabled
 * or disabled.
 */
static int fake_lm_get(struct vme_lm_resource *lm,
		       unsigned long long *lm_base,
		       u32 *aspace, u32 *cycle)
{}

/*
 * Attach a callback to a specific location monitor.
 *
 * Callback will be passed the monitor triggered.
 */
static int fake_lm_attach(struct vme_lm_resource *lm, int monitor,
			  void (*callback)(void *), void *data)
{}

/*
 * Detach a callback function forn a specific location monitor.
 */
static int fake_lm_detach(struct vme_lm_resource *lm, int monitor)
{}

/*
 * Determine Geographical Addressing
 */
static int fake_slot_get(struct vme_bridge *fake_bridge)
{}

static void *fake_alloc_consistent(struct device *parent, size_t size,
				   dma_addr_t *dma)
{}

static void fake_free_consistent(struct device *parent, size_t size,
				 void *vaddr, dma_addr_t dma)
{}

/*
 * Configure CR/CSR space
 *
 * Access to the CR/CSR can be configured at power-up. The location of the
 * CR/CSR registers in the CR/CSR address space is determined by the boards
 * Geographic address.
 *
 * Each board has a 512kB window, with the highest 4kB being used for the
 * boards registers, this means there is a fix length 508kB window which must
 * be mapped onto PCI memory.
 */
static int fake_crcsr_init(struct vme_bridge *fake_bridge)
{}

static void fake_crcsr_exit(struct vme_bridge *fake_bridge)
{}

static int __init fake_init(void)
{}

static void __exit fake_exit(void)
{}

MODULE_PARM_DESC();
module_param(geoid, int, 0);

MODULE_DESCRIPTION();
MODULE_LICENSE();

module_init();
module_exit(fake_exit);