#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/delay.h>
#include <linux/bitops.h>
#include <linux/uaccess.h>
#include <asm/io.h>
#ifdef CONFIG_NET_POLL_CONTROLLER
#include <asm/irq.h>
#endif
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
#define xw32(reg, val) …
#define xr32(reg) …
#define xr8(reg) …
#define CSR0 …
#define CSR1 …
#define CSR2 …
#define CSR3 …
#define CSR4 …
#define CSR5 …
#define CSR6 …
#define CSR7 …
#define CSR8 …
#define CSR9 …
#define CSR10 …
#define CSR11 …
#define CSR12 …
#define CSR13 …
#define CSR14 …
#define CSR15 …
#define CSR16 …
#define PCI_POWERMGMT …
#define NUMDESCRIPTORS …
static int bufferoffsets[NUMDESCRIPTORS] = …;
struct xircom_private { … };
static int xircom_probe(struct pci_dev *pdev, const struct pci_device_id *id);
static void xircom_remove(struct pci_dev *pdev);
static irqreturn_t xircom_interrupt(int irq, void *dev_instance);
static netdev_tx_t xircom_start_xmit(struct sk_buff *skb,
struct net_device *dev);
static int xircom_open(struct net_device *dev);
static int xircom_close(struct net_device *dev);
static void xircom_up(struct xircom_private *card);
#ifdef CONFIG_NET_POLL_CONTROLLER
static void xircom_poll_controller(struct net_device *dev);
#endif
static void investigate_read_descriptor(struct net_device *dev,struct xircom_private *card, int descnr, unsigned int bufferoffset);
static void investigate_write_descriptor(struct net_device *dev, struct xircom_private *card, int descnr, unsigned int bufferoffset);
static void read_mac_address(struct xircom_private *card);
static void transceiver_voodoo(struct xircom_private *card);
static void initialize_card(struct xircom_private *card);
static void trigger_transmit(struct xircom_private *card);
static void trigger_receive(struct xircom_private *card);
static void setup_descriptors(struct xircom_private *card);
static void remove_descriptors(struct xircom_private *card);
static int link_status_changed(struct xircom_private *card);
static void activate_receiver(struct xircom_private *card);
static void deactivate_receiver(struct xircom_private *card);
static void activate_transmitter(struct xircom_private *card);
static void deactivate_transmitter(struct xircom_private *card);
static void enable_transmit_interrupt(struct xircom_private *card);
static void enable_receive_interrupt(struct xircom_private *card);
static void enable_link_interrupt(struct xircom_private *card);
static void disable_all_interrupts(struct xircom_private *card);
static int link_status(struct xircom_private *card);
static const struct pci_device_id xircom_pci_table[] = …;
MODULE_DEVICE_TABLE(pci, xircom_pci_table);
static struct pci_driver xircom_ops = …;
#if defined DEBUG && DEBUG > 1
static void print_binary(unsigned int number)
{
int i,i2;
char buffer[64];
memset(buffer,0,64);
i2=0;
for (i=31;i>=0;i--) {
if (number & (1<<i))
buffer[i2++]='1';
else
buffer[i2++]='0';
if ((i&3)==0)
buffer[i2++]=' ';
}
pr_debug("%s\n",buffer);
}
#endif
static const struct net_device_ops netdev_ops = …;
static int xircom_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{ … }
static void xircom_remove(struct pci_dev *pdev)
{ … }
static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
{ … }
static netdev_tx_t xircom_start_xmit(struct sk_buff *skb,
struct net_device *dev)
{ … }
static int xircom_open(struct net_device *dev)
{ … }
static int xircom_close(struct net_device *dev)
{ … }
#ifdef CONFIG_NET_POLL_CONTROLLER
static void xircom_poll_controller(struct net_device *dev)
{ … }
#endif
static void initialize_card(struct xircom_private *card)
{ … }
static void trigger_transmit(struct xircom_private *card)
{ … }
static void trigger_receive(struct xircom_private *card)
{ … }
static void setup_descriptors(struct xircom_private *card)
{ … }
static void remove_descriptors(struct xircom_private *card)
{ … }
static int link_status_changed(struct xircom_private *card)
{ … }
static int transmit_active(struct xircom_private *card)
{ … }
static int receive_active(struct xircom_private *card)
{ … }
static void activate_receiver(struct xircom_private *card)
{ … }
static void deactivate_receiver(struct xircom_private *card)
{ … }
static void activate_transmitter(struct xircom_private *card)
{ … }
static void deactivate_transmitter(struct xircom_private *card)
{ … }
static void enable_transmit_interrupt(struct xircom_private *card)
{ … }
static void enable_receive_interrupt(struct xircom_private *card)
{ … }
static void enable_link_interrupt(struct xircom_private *card)
{ … }
static void disable_all_interrupts(struct xircom_private *card)
{ … }
static void enable_common_interrupts(struct xircom_private *card)
{ … }
static int enable_promisc(struct xircom_private *card)
{ … }
static int link_status(struct xircom_private *card)
{ … }
static void read_mac_address(struct xircom_private *card)
{ … }
static void transceiver_voodoo(struct xircom_private *card)
{ … }
static void xircom_up(struct xircom_private *card)
{ … }
static void
investigate_read_descriptor(struct net_device *dev, struct xircom_private *card,
int descnr, unsigned int bufferoffset)
{ … }
static void
investigate_write_descriptor(struct net_device *dev,
struct xircom_private *card,
int descnr, unsigned int bufferoffset)
{ … }
module_pci_driver(…) …;