linux/drivers/net/ethernet/8390/ne2k-pci.c

// SPDX-License-Identifier: GPL-1.0+
/* A Linux device driver for PCI NE2000 clones.
 *
 * Authors and other copyright holders:
 * 1992-2000 by Donald Becker, NE2000 core and various modifications.
 * 1995-1998 by Paul Gortmaker, core modifications and PCI support.
 * Copyright 1993 assigned to the United States Government as represented
 * by the Director, National Security Agency.
 *
 * 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
 *
 * Issues remaining:
 * People are making PCI NE2000 clones! Oh the horror, the horror...
 * Limited full-duplex support.
 */

#define DRV_NAME
#define DRV_DESCRIPTION
#define DRV_AUTHOR
#define DRV_VERSION
#define DRV_RELDATE

#define pr_fmt(fmt)

/* The user-configurable values.
 * These may be modified when a driver module is loaded.
 */

/* More are supported, limit only on options */
#define MAX_UNITS

/* Used to pass the full-duplex flag, etc. */
static int full_duplex[MAX_UNITS];
static int options[MAX_UNITS];

/* Force a non std. amount of memory.  Units are 256 byte pages. */
/* #define PACKETBUF_MEMSIZE	0x40 */


#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/ethtool.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>

#include <linux/io.h>
#include <asm/irq.h>
#include <linux/uaccess.h>

#include "8390.h"

static int ne2k_msg_enable;

static const int default_msg_level =;

#if defined(__powerpc__)
#define inl_le
#define inw_le
#endif

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

module_param_named(msg_enable, ne2k_msg_enable, int, 0444);
module_param_array();
module_param_array();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();

/* Some defines that people can play with if so inclined.
 */

/* Use 32 bit data-movement operations instead of 16 bit. */
#define USE_LONGIO

/* Do we implement the read before write bugfix ? */
/* #define NE_RW_BUGFIX */

/* Flags.  We rename an existing ei_status field to store flags!
 * Thus only the low 8 bits are usable for non-init-time flags.
 */
#define ne2k_flags

enum {};

enum ne2k_pci_chipsets {};


static struct {} pci_clone_list[] =;


static const struct pci_device_id ne2k_pci_tbl[] =;

MODULE_DEVICE_TABLE(pci, ne2k_pci_tbl);


/* ---- No user-serviceable parts below ---- */

#define NE_BASE
#define NE_CMD
#define NE_DATAPORT
#define NE_RESET
#define NE_IO_EXTENT

#define NESM_START_PG
#define NESM_STOP_PG


static int ne2k_pci_open(struct net_device *dev);
static int ne2k_pci_close(struct net_device *dev);

static void ne2k_pci_reset_8390(struct net_device *dev);
static void ne2k_pci_get_8390_hdr(struct net_device *dev,
				  struct e8390_pkt_hdr *hdr, int ring_page);
static void ne2k_pci_block_input(struct net_device *dev, int count,
				 struct sk_buff *skb, int ring_offset);
static void ne2k_pci_block_output(struct net_device *dev, const int count,
				  const unsigned char *buf,
				  const int start_page);
static const struct ethtool_ops ne2k_pci_ethtool_ops;


/* NEx000-clone boards have a Station Address (SA) PROM (SAPROM) in the packet
 * buffer memory space.  By-the-spec NE2000 clones have 0x57,0x57 in bytes
 * 0x0e,0x0f of the SAPROM, while other supposed NE2000 clones must be
 * detected by their SA prefix.
 *
 * Reading the SAPROM from a word-wide card with the 8390 set in byte-wide
 * mode results in doubled values, which can be detected and compensated for.
 *
 * The probe is also responsible for initializing the card and filling
 * in the 'dev' and 'ei_status' structures.
 */

static const struct net_device_ops ne2k_netdev_ops =;

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

/* Magic incantation sequence for full duplex on the supported cards.
 */
static inline int set_realtek_fdx(struct net_device *dev)
{}

static inline int set_holtek_fdx(struct net_device *dev)
{}

static int ne2k_pci_set_fdx(struct net_device *dev)
{}

static int ne2k_pci_open(struct net_device *dev)
{}

static int ne2k_pci_close(struct net_device *dev)
{}

/* Hard reset the card.  This used to pause for the same period that a
 * 8390 reset command required, but that shouldn't be necessary.
 */
static void ne2k_pci_reset_8390(struct net_device *dev)
{}

/* Grab the 8390 specific header. Similar to the block_input routine, but
 * we don't need to be concerned with ring wrap as the header will be at
 * the start of a page, so we optimize accordingly.
 */

static void ne2k_pci_get_8390_hdr(struct net_device *dev,
				  struct e8390_pkt_hdr *hdr, int ring_page)
{}

/* Block input and output, similar to the Crynwr packet driver.  If you
 *are porting to a new ethercard, look at the packet driver source for hints.
 *The NEx000 doesn't share the on-board packet memory -- you have to put
 *the packet out through the "remote DMA" dataport using outb.
 */

static void ne2k_pci_block_input(struct net_device *dev, int count,
				 struct sk_buff *skb, int ring_offset)
{}

static void ne2k_pci_block_output(struct net_device *dev, int count,
		const unsigned char *buf, const int start_page)
{}

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

static u32 ne2k_pci_get_msglevel(struct net_device *dev)
{}

static void ne2k_pci_set_msglevel(struct net_device *dev, u32 v)
{}

static const struct ethtool_ops ne2k_pci_ethtool_ops =;

static void ne2k_pci_remove_one(struct pci_dev *pdev)
{}

static int __maybe_unused ne2k_pci_suspend(struct device *dev_d)
{}

static int __maybe_unused ne2k_pci_resume(struct device *dev_d)
{}

static SIMPLE_DEV_PM_OPS(ne2k_pci_pm_ops, ne2k_pci_suspend, ne2k_pci_resume);

static struct pci_driver ne2k_driver =;
module_pci_driver();