linux/drivers/net/ethernet/sun/sungem.c

// SPDX-License-Identifier: GPL-2.0
/* $Id: sungem.c,v 1.44.2.22 2002/03/13 01:18:12 davem Exp $
 * sungem.c: Sun GEM ethernet driver.
 *
 * Copyright (C) 2000, 2001, 2002, 2003 David S. Miller ([email protected])
 *
 * Support for Apple GMAC and assorted PHYs, WOL, Power Management
 * (C) 2001,2002,2003 Benjamin Herrenscmidt ([email protected])
 * (C) 2004,2005 Benjamin Herrenscmidt, IBM Corp.
 *
 * NAPI and NETPOLL support
 * (C) 2004 by Eric Lemoine ([email protected])
 *
 */

#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/mii.h>
#include <linux/ethtool.h>
#include <linux/crc32.h>
#include <linux/random.h>
#include <linux/workqueue.h>
#include <linux/if_vlan.h>
#include <linux/bitops.h>
#include <linux/mm.h>
#include <linux/gfp.h>
#include <linux/of.h>

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

#ifdef CONFIG_SPARC
#include <asm/idprom.h>
#include <asm/prom.h>
#endif

#ifdef CONFIG_PPC_PMAC
#include <asm/machdep.h>
#include <asm/pmac_feature.h>
#endif

#include <linux/sungem_phy.h>
#include "sungem.h"

#define STRIP_FCS

#define DEFAULT_MSG

#define ADVERTISE_MASK

#define DRV_NAME
#define DRV_VERSION
#define DRV_AUTHOR

static char version[] =;

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

#define GEM_MODULE_NAME

static const struct pci_device_id gem_pci_tbl[] =;

MODULE_DEVICE_TABLE(pci, gem_pci_tbl);

static u16 __sungem_phy_read(struct gem *gp, int phy_addr, int reg)
{}

static inline int _sungem_phy_read(struct net_device *dev, int mii_id, int reg)
{}

static inline u16 sungem_phy_read(struct gem *gp, int reg)
{}

static void __sungem_phy_write(struct gem *gp, int phy_addr, int reg, u16 val)
{}

static inline void _sungem_phy_write(struct net_device *dev, int mii_id, int reg, int val)
{}

static inline void sungem_phy_write(struct gem *gp, int reg, u16 val)
{}

static inline void gem_enable_ints(struct gem *gp)
{}

static inline void gem_disable_ints(struct gem *gp)
{}

static void gem_get_cell(struct gem *gp)
{}

/* Turn off the chip's clock */
static void gem_put_cell(struct gem *gp)
{}

static inline void gem_netif_stop(struct gem *gp)
{}

static inline void gem_netif_start(struct gem *gp)
{}

static void gem_schedule_reset(struct gem *gp)
{}

static void gem_handle_mif_event(struct gem *gp, u32 reg_val, u32 changed_bits)
{}

static int gem_pcs_interrupt(struct net_device *dev, struct gem *gp, u32 gem_status)
{}

static int gem_txmac_interrupt(struct net_device *dev, struct gem *gp, u32 gem_status)
{}

/* When we get a RX fifo overflow, the RX unit in GEM is probably hung
 * so we do the following.
 *
 * If any part of the reset goes wrong, we return 1 and that causes the
 * whole chip to be reset.
 */
static int gem_rxmac_reset(struct gem *gp)
{}

static int gem_rxmac_interrupt(struct net_device *dev, struct gem *gp, u32 gem_status)
{}

static int gem_mac_interrupt(struct net_device *dev, struct gem *gp, u32 gem_status)
{}

static int gem_mif_interrupt(struct net_device *dev, struct gem *gp, u32 gem_status)
{}

static int gem_pci_interrupt(struct net_device *dev, struct gem *gp, u32 gem_status)
{}

/* All non-normal interrupt conditions get serviced here.
 * Returns non-zero if we should just exit the interrupt
 * handler right now (ie. if we reset the card which invalidates
 * all of the other original irq status bits).
 */
static int gem_abnormal_irq(struct net_device *dev, struct gem *gp, u32 gem_status)
{}

static __inline__ void gem_tx(struct net_device *dev, struct gem *gp, u32 gem_status)
{}

static __inline__ void gem_post_rxds(struct gem *gp, int limit)
{}

#define ALIGNED_RX_SKB_ADDR(addr)
static __inline__ struct sk_buff *gem_alloc_skb(struct net_device *dev, int size,
						gfp_t gfp_flags)
{}

static int gem_rx(struct gem *gp, int work_to_do)
{}

static int gem_poll(struct napi_struct *napi, int budget)
{}

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

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

static __inline__ int gem_intme(int entry)
{}

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

static void gem_pcs_reset(struct gem *gp)
{}

static void gem_pcs_reinit_adv(struct gem *gp)
{}

#define STOP_TRIES

static void gem_reset(struct gem *gp)
{}

static void gem_start_dma(struct gem *gp)
{}

/* DMA won't be actually stopped before about 4ms tho ...
 */
static void gem_stop_dma(struct gem *gp)
{}


// XXX dbl check what that function should do when called on PCS PHY
static void gem_begin_auto_negotiation(struct gem *gp,
				       const struct ethtool_link_ksettings *ep)
{}

/* A link-up condition has occurred, initialize and enable the
 * rest of the chip.
 */
static int gem_set_link_modes(struct gem *gp)
{}

static int gem_mdio_link_not_up(struct gem *gp)
{}

static void gem_link_timer(struct timer_list *t)
{}

static void gem_clean_rings(struct gem *gp)
{}

static void gem_init_rings(struct gem *gp)
{}

/* Init PHY interface and start link poll state machine */
static void gem_init_phy(struct gem *gp)
{}

static void gem_init_dma(struct gem *gp)
{}

static u32 gem_setup_multicast(struct gem *gp)
{}

static void gem_init_mac(struct gem *gp)
{}

static void gem_init_pause_thresholds(struct gem *gp)
{}

static int gem_check_invariants(struct gem *gp)
{}

static void gem_reinit_chip(struct gem *gp)
{}


static void gem_stop_phy(struct gem *gp, int wol)
{}

static int gem_do_start(struct net_device *dev)
{}

static void gem_do_stop(struct net_device *dev, int wol)
{}

static void gem_reset_task(struct work_struct *work)
{}

static int gem_open(struct net_device *dev)
{}

static int gem_close(struct net_device *dev)
{}

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

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

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

static int gem_set_mac_address(struct net_device *dev, void *addr)
{}

static void gem_set_multicast(struct net_device *dev)
{}

/* Jumbo-grams don't seem to work :-( */
#define GEM_MIN_MTU
#if 1
#define GEM_MAX_MTU
#else
#define GEM_MAX_MTU
#endif

static int gem_change_mtu(struct net_device *dev, int new_mtu)
{}

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

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

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

static int gem_nway_reset(struct net_device *dev)
{}

static u32 gem_get_msglevel(struct net_device *dev)
{}

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


/* Add more when I understand how to program the chip */
/* like WAKE_UCAST | WAKE_MCAST | WAKE_BCAST */

#define WOL_SUPPORTED_MASK

static void gem_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{}

static int gem_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{}

static const struct ethtool_ops gem_ethtool_ops =;

static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{}

#if (!defined(CONFIG_SPARC) && !defined(CONFIG_PPC_PMAC))
/* Fetch MAC address from vital product data of PCI ROM. */
static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr)
{}

static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr)
{}
#endif /* not Sparc and not PPC */

static int gem_get_device_address(struct gem *gp)
{}

static void gem_remove_one(struct pci_dev *pdev)
{}

static const struct net_device_ops gem_netdev_ops =;

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

static SIMPLE_DEV_PM_OPS(gem_pm_ops, gem_suspend, gem_resume);

static struct pci_driver gem_driver =;

module_pci_driver();