linux/drivers/net/ethernet/fealnx.c

/*
	Written 1998-2000 by Donald Becker.

	This software may be used and distributed according to the terms of
	the GNU General Public License (GPL), incorporated herein by reference.
	Drivers based on or derived from this code fall under the GPL and must
	retain the authorship, copyright and license notice.  This file is not
	a complete program and may only be used when the entire operating
	system is licensed under the GPL.

	The author may be reached as [email protected], or C/O
	Scyld Computing Corporation
	410 Severn Ave., Suite 210
	Annapolis MD 21403

	Support information and updates available at
	http://www.scyld.com/network/pci-skeleton.html

	Linux kernel updates:

	Version 2.51, Nov 17, 2001 (jgarzik):
	- Add ethtool support
	- Replace some MII-related magic numbers with constants

*/

#define DRV_NAME

static int debug;		/* 1-> print debug message */
static int max_interrupt_work =;

/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). */
static int multicast_filter_limit =;

/* Set the copy breakpoint for the copy-only-tiny-frames scheme. */
/* Setting to > 1518 effectively disables this feature.          */
static int rx_copybreak;

/* Used to pass the media type, etc.                            */
/* Both 'options[]' and 'full_duplex[]' should exist for driver */
/* interoperability.                                            */
/* The media type is usually passed in 'options[]'.             */
#define MAX_UNITS
static int options[MAX_UNITS] =;
static int full_duplex[MAX_UNITS] =;

/* Operational parameters that are set at compile time.                 */
/* Keep the ring sizes a power of two for compile efficiency.           */
/* The compiler will convert <unsigned>'%'<2^N> into a bit mask.        */
/* Making the Tx ring too large decreases the effectiveness of channel  */
/* bonding and packet priority.                                         */
/* There are no ill effects from too-large receive rings.               */
// 88-12-9 modify,
// #define TX_RING_SIZE    16
// #define RX_RING_SIZE    32
#define TX_RING_SIZE
#define RX_RING_SIZE
#define TX_TOTAL_SIZE
#define RX_TOTAL_SIZE

/* Operational parameters that usually are not changed. */
/* Time in jiffies before concluding the transmitter is hung. */
#define TX_TIMEOUT

#define PKT_BUF_SZ


/* Include files, designed to support most kernel versions 2.0.0 and later. */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/init.h>
#include <linux/mii.h>
#include <linux/ethtool.h>
#include <linux/crc32.h>
#include <linux/delay.h>
#include <linux/bitops.h>

#include <asm/processor.h>	/* Processor type for cache alignment. */
#include <asm/io.h>
#include <linux/uaccess.h>
#include <asm/byteorder.h>

/* This driver was written to use PCI memory space, however some x86 systems
   work only with I/O space accesses. */
#ifndef __alpha__
#define USE_IO_OPS
#endif

/* Kernel compatibility defines, some common to David Hinds' PCMCIA package. */
/* This is only in the support-all-kernels source code. */

#define RUN_AT(x)

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
module_param(max_interrupt_work, int, 0);
module_param(debug, int, 0);
module_param(rx_copybreak, int, 0);
module_param(multicast_filter_limit, int, 0);
module_param_array();
module_param_array();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();

enum {};

/* A chip capabilities table, matching the entries in pci_tbl[] above. */
enum chip_capability_flags {};

/* 89/6/13 add, */
/* for different PHY */
enum phy_type_flags {};

struct chip_info {};

static const struct chip_info skel_netdrv_tbl[] =;

/* Offsets to the Command and Status Registers. */
enum fealnx_offsets {};

/* Bits in the interrupt status/enable registers. */
/* The bits in the Intr Status/Enable registers, mostly interrupt sources. */
enum intr_status_bits {};

/* Bits in the NetworkConfig register, W for writing, R for reading */
/* FIXME: some names are invented by me. Marked with (name?) */
/* If you have docs and know bit names, please fix 'em */
enum rx_mode_bits {};

/* The Tulip Rx and Tx buffer descriptors. */
struct fealnx_desc {};

/* Bits in network_desc.status */
enum rx_desc_status_bits {};

enum rx_desc_control_bits {};

enum tx_desc_status_bits {};

enum tx_desc_control_bits {};

/* BootROM/EEPROM/MII Management Register */
#define MASK_MIIR_MII_READ
#define MASK_MIIR_MII_WRITE
#define MASK_MIIR_MII_MDO
#define MASK_MIIR_MII_MDI
#define MASK_MIIR_MII_MDC

/* ST+OP+PHYAD+REGAD+TA */
#define OP_READ
#define OP_WRITE

/* ------------------------------------------------------------------------- */
/*      Constants for Myson PHY                                              */
/* ------------------------------------------------------------------------- */
#define MysonPHYID
/* 89-7-27 add, (begin) */
#define MysonPHYID0
#define StatusRegister
#define SPEED100
#define FULLMODE
/* 89-7-27 add, (end) */

/* ------------------------------------------------------------------------- */
/*      Constants for Seeq 80225 PHY                                         */
/* ------------------------------------------------------------------------- */
#define SeeqPHYID0

#define MIIRegister18
#define SPD_DET_100
#define DPLX_DET_FULL

/* ------------------------------------------------------------------------- */
/*      Constants for Ahdoc 101 PHY                                          */
/* ------------------------------------------------------------------------- */
#define AhdocPHYID0

#define DiagnosticReg
#define DPLX_FULL
#define Speed_100

/* 89/6/13 add, */
/* -------------------------------------------------------------------------- */
/*      Constants                                                             */
/* -------------------------------------------------------------------------- */
#define MarvellPHYID0
#define LevelOnePHYID0

#define MII1000BaseTControlReg
#define MII1000BaseTStatusReg
#define SpecificReg

/* for 1000BaseT Control Register */
#define PHYAbletoPerform1000FullDuplex
#define PHYAbletoPerform1000HalfDuplex
#define PHY1000AbilityMask

// for phy specific status register, marvell phy.
#define SpeedMask
#define Speed_1000M
#define Speed_100M
#define Speed_10M
#define Full_Duplex

// 89/12/29 add, for phy specific status register, levelone phy, (begin)
#define LXT1000_100M
#define LXT1000_1000M
#define LXT1000_Full
// 89/12/29 add, for phy specific status register, levelone phy, (end)

/* for 3-in-1 case, BMCRSR register */
#define LinkIsUp2

/* for PHY */
#define LinkIsUp


struct netdev_private {};


static int mdio_read(struct net_device *dev, int phy_id, int location);
static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
static int netdev_open(struct net_device *dev);
static void getlinktype(struct net_device *dev);
static void getlinkstatus(struct net_device *dev);
static void netdev_timer(struct timer_list *t);
static void reset_timer(struct timer_list *t);
static void fealnx_tx_timeout(struct net_device *dev, unsigned int txqueue);
static void init_ring(struct net_device *dev);
static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
static irqreturn_t intr_handler(int irq, void *dev_instance);
static int netdev_rx(struct net_device *dev);
static void set_rx_mode(struct net_device *dev);
static void __set_rx_mode(struct net_device *dev);
static struct net_device_stats *get_stats(struct net_device *dev);
static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static const struct ethtool_ops netdev_ethtool_ops;
static int netdev_close(struct net_device *dev);
static void reset_rx_descriptors(struct net_device *dev);
static void reset_tx_descriptors(struct net_device *dev);

static void stop_nic_rx(void __iomem *ioaddr, long crvalue)
{}


static void stop_nic_rxtx(void __iomem *ioaddr, long crvalue)
{}

static const struct net_device_ops netdev_ops =;

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


static void fealnx_remove_one(struct pci_dev *pdev)
{}


static ulong m80x_send_cmd_to_phy(void __iomem *miiport, int opcode, int phyad, int regad)
{}


static int mdio_read(struct net_device *dev, int phyad, int regad)
{}


static void mdio_write(struct net_device *dev, int phyad, int regad, int data)
{}


static int netdev_open(struct net_device *dev)
{}


static void getlinkstatus(struct net_device *dev)
/* function: Routine will read MII Status Register to get link status.       */
/* input   : dev... pointer to the adapter block.                            */
/* output  : none.                                                           */
{}


static void getlinktype(struct net_device *dev)
{}


/* Take lock before calling this */
static void allocate_rx_buffers(struct net_device *dev)
{}


static void netdev_timer(struct timer_list *t)
{}


/* Take lock before calling */
/* Reset chip and disable rx, tx and interrupts */
static void reset_and_disable_rxtx(struct net_device *dev)
{}


/* Take lock before calling */
/* Restore chip after reset */
static void enable_rxtx(struct net_device *dev)
{}


static void reset_timer(struct timer_list *t)
{}


static void fealnx_tx_timeout(struct net_device *dev, unsigned int txqueue)
{}


/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
static void init_ring(struct net_device *dev)
{}


static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
{}


/* Take lock before calling */
/* Chip probably hosed tx ring. Clean up. */
static void reset_tx_descriptors(struct net_device *dev)
{}


/* Take lock and stop rx before calling this */
static void reset_rx_descriptors(struct net_device *dev)
{}


/* The interrupt handler does all of the Rx thread work and cleans up
   after the Tx thread. */
static irqreturn_t intr_handler(int irq, void *dev_instance)
{}


/* This routine is logically part of the interrupt handler, but separated
   for clarity and better register allocation. */
static int netdev_rx(struct net_device *dev)
{}


static struct net_device_stats *get_stats(struct net_device *dev)
{}


/* for dev->set_multicast_list */
static void set_rx_mode(struct net_device *dev)
{}


/* Take lock before calling */
static void __set_rx_mode(struct net_device *dev)
{}

static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{}

static int netdev_get_link_ksettings(struct net_device *dev,
				     struct ethtool_link_ksettings *cmd)
{}

static int netdev_set_link_ksettings(struct net_device *dev,
				     const struct ethtool_link_ksettings *cmd)
{}

static int netdev_nway_reset(struct net_device *dev)
{}

static u32 netdev_get_link(struct net_device *dev)
{}

static u32 netdev_get_msglevel(struct net_device *dev)
{}

static void netdev_set_msglevel(struct net_device *dev, u32 value)
{}

static const struct ethtool_ops netdev_ethtool_ops =;

static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{}


static int netdev_close(struct net_device *dev)
{}

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


static struct pci_driver fealnx_driver =;

module_pci_driver();