linux/drivers/atm/eni.c

// SPDX-License-Identifier: GPL-2.0-only
/* drivers/atm/eni.c - Efficient Networks ENI155P device driver */
 
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
 

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/atm.h>
#include <linux/atmdev.h>
#include <linux/sonet.h>
#include <linux/skbuff.h>
#include <linux/time.h>
#include <linux/delay.h>
#include <linux/uio.h>
#include <linux/init.h>
#include <linux/atm_eni.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <asm/io.h>
#include <linux/atomic.h>
#include <linux/uaccess.h>
#include <asm/string.h>
#include <asm/byteorder.h>

#include "tonga.h"
#include "midway.h"
#include "suni.h"
#include "eni.h"

/*
 * TODO:
 *
 * Show stoppers
 *  none
 *
 * Minor
 *  - OAM support
 *  - fix bugs listed below
 */

/*
 * KNOWN BUGS:
 *
 * - may run into JK-JK bug and deadlock
 * - should allocate UBR channel first
 * - buffer space allocation algorithm is stupid
 *   (RX: should be maxSDU+maxdelay*rate
 *    TX: should be maxSDU+min(maxSDU,maxdelay*rate) )
 * - doesn't support OAM cells
 * - eni_put_free may hang if not putting memory fragments that _complete_
 *   2^n block (never happens in real life, though)
 */


#if 0
#define DPRINTK
#else
#define DPRINTK(format,args...)
#endif


#ifndef CONFIG_ATM_ENI_TUNE_BURST
#define CONFIG_ATM_ENI_BURST_TX_8W
#define CONFIG_ATM_ENI_BURST_RX_4W
#endif


#ifndef CONFIG_ATM_ENI_DEBUG


#define NULLCHECK

#define EVENT


static void event_dump(void)
{
}


#else


/* 
 * NULL pointer checking
 */

#define NULLCHECK(x)

/*
 * Very extensive activity logging. Greatly improves bug detection speed but
 * costs a few Mbps if enabled.
 */

#define EV

static const char *ev[EV];
static unsigned long ev_a[EV],ev_b[EV];
static int ec =;


static void EVENT(const char *s,unsigned long a,unsigned long b)
{}


static void event_dump(void)
{}


#endif /* CONFIG_ATM_ENI_DEBUG */


/*
 * NExx   must not be equal at end
 * EExx   may be equal at end
 * xxPJOK verify validity of pointer jumps
 * xxPMOK operating on a circular buffer of "c" words
 */

#define NEPJOK(a0,a1,b)
#define EEPJOK(a0,a1,b)
#define NEPMOK(a0,d,b,c)
#define EEPMOK(a0,d,b,c)


static int tx_complete =,dma_complete =,queued =,requeued =,
  backlogged =,rx_enqueued =,rx_dequeued =,pushed =,submitted =,
  putting =;

static struct atm_dev *eni_boards =;

/* Read/write registers on card */
#define eni_in(r)
#define eni_out(v,r)


/*-------------------------------- utilities --------------------------------*/


static void dump_mem(struct eni_dev *eni_dev)
{}


static void dump(struct atm_dev *dev)
{}


static void eni_put_free(struct eni_dev *eni_dev, void __iomem *start,
    unsigned long size)
{}


static void __iomem *eni_alloc_mem(struct eni_dev *eni_dev, unsigned long *size)
{}


static void eni_free_mem(struct eni_dev *eni_dev, void __iomem *start,
    unsigned long size)
{}


/*----------------------------------- RX ------------------------------------*/


#define ENI_VCC_NOS


static void rx_ident_err(struct atm_vcc *vcc)
{}


static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,
    unsigned long skip,unsigned long size,unsigned long eff)
{}


static void discard(struct atm_vcc *vcc,unsigned long size)
{}


/*
 * TODO: should check whether direct copies (without DMA setup, dequeuing on
 * interrupt, etc.) aren't much faster for AAL0
 */

static int rx_aal0(struct atm_vcc *vcc)
{}


static int rx_aal5(struct atm_vcc *vcc)
{}


static inline int rx_vcc(struct atm_vcc *vcc)
{}


static void poll_rx(struct atm_dev *dev)
{}


static void get_service(struct atm_dev *dev)
{}


static void dequeue_rx(struct atm_dev *dev)
{}


static int open_rx_first(struct atm_vcc *vcc)
{}


static int open_rx_second(struct atm_vcc *vcc)
{}


static void close_rx(struct atm_vcc *vcc)
{}


static int start_rx(struct atm_dev *dev)
{}


/*----------------------------------- TX ------------------------------------*/


enum enq_res {};


static inline void put_dma(int chan,u32 *dma,int *j,dma_addr_t paddr,
    u32 size)
{}


static enum enq_res do_tx(struct sk_buff *skb)
{}


static void poll_tx(struct atm_dev *dev)
{}


static void dequeue_tx(struct atm_dev *dev)
{}


static struct eni_tx *alloc_tx(struct eni_dev *eni_dev,int ubr)
{}


static int comp_tx(struct eni_dev *eni_dev,int *pcr,int reserved,int *pre,
    int *res,int unlimited)
{}


static int reserve_or_set_tx(struct atm_vcc *vcc,struct atm_trafprm *txtp,
    int set_rsv,int set_shp)
{}


static int open_tx_first(struct atm_vcc *vcc)
{}


static int open_tx_second(struct atm_vcc *vcc)
{}


static void close_tx(struct atm_vcc *vcc)
{}


static int start_tx(struct atm_dev *dev)
{}


/*--------------------------------- common ----------------------------------*/


#if 0 /* may become useful again when tuning things */

static void foo(void)
{
printk(KERN_INFO
  "tx_complete=%d,dma_complete=%d,queued=%d,requeued=%d,sub=%d,\n"
  "backlogged=%d,rx_enqueued=%d,rx_dequeued=%d,putting=%d,pushed=%d\n",
  tx_complete,dma_complete,queued,requeued,submitted,backlogged,
  rx_enqueued,rx_dequeued,putting,pushed);
if (eni_boards) printk(KERN_INFO "loss: %ld\n",ENI_DEV(eni_boards)->lost);
}

#endif


static void bug_int(struct atm_dev *dev,unsigned long reason)
{}


static irqreturn_t eni_int(int irq,void *dev_id)
{}


static void eni_tasklet(unsigned long data)
{}


/*--------------------------------- entries ---------------------------------*/


static char * const media_name[] =;


#define SET_SEPROM
#define GET_SEPROM


static int get_esi_asic(struct atm_dev *dev)
{}


#undef SET_SEPROM
#undef GET_SEPROM


static int get_esi_fpga(struct atm_dev *dev, void __iomem *base)
{}


static int eni_do_init(struct atm_dev *dev)
{}

static void eni_do_release(struct atm_dev *dev)
{}

static int eni_start(struct atm_dev *dev)
{}


static void eni_close(struct atm_vcc *vcc)
{}


static int eni_open(struct atm_vcc *vcc)
{}


static int eni_change_qos(struct atm_vcc *vcc,struct atm_qos *qos,int flgs)
{}


static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
{}

static int eni_send(struct atm_vcc *vcc,struct sk_buff *skb)
{}

static void eni_phy_put(struct atm_dev *dev,unsigned char value,
    unsigned long addr)
{}



static unsigned char eni_phy_get(struct atm_dev *dev,unsigned long addr)
{}


static int eni_proc_read(struct atm_dev *dev,loff_t *pos,char *page)
{}


static const struct atmdev_ops ops =;


static int eni_init_one(struct pci_dev *pci_dev,
			const struct pci_device_id *ent)
{}


static const struct pci_device_id eni_pci_tbl[] =;
MODULE_DEVICE_TABLE(pci,eni_pci_tbl);


static void eni_remove_one(struct pci_dev *pdev)
{}


static struct pci_driver eni_driver =;


static int __init eni_init(void)
{}


module_init();
/* @@@ since exit routine not defined, this module can not be unloaded */

MODULE_DESCRIPTION();
MODULE_LICENSE();