drivers/net/ethernet/dec/tulip/winbond-840.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/dec/tulip/winbond-840.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/dec/tulip/winbond-840.c- Extension
.c- Size
- 48243 bytes
- Lines
- 1637
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/string.hlinux/timer.hlinux/errno.hlinux/ioport.hlinux/interrupt.hlinux/pci.hlinux/dma-mapping.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/init.hlinux/delay.hlinux/ethtool.hlinux/mii.hlinux/rtnetlink.hlinux/crc32.hlinux/bitops.hlinux/uaccess.hasm/processor.hasm/io.hasm/irq.htulip.h
Detected Declarations
struct pci_id_infostruct w840_rx_descstruct w840_tx_descstruct netdev_privateenum chip_capability_flagsenum w840_offsetsenum rx_mode_bitsenum mii_reg_bitsenum EEPROM_Ctrl_Bitsenum EEPROM_Cmdsfunction w840_probe1function eeprom_readfunction mdio_syncfunction mdio_readfunction mdio_writefunction netdev_openfunction update_linkfunction update_csr6function netdev_timerfunction init_rxtx_ringsfunction free_rxtx_ringsfunction init_registersfunction tx_timeoutfunction alloc_ringdescfunction free_ringdescfunction start_txfunction netdev_tx_donefunction intr_handlerfunction netdev_rxfunction netdev_errorfunction __set_rx_modefunction netdev_for_each_mc_addrfunction set_rx_modefunction netdev_get_drvinfofunction netdev_get_link_ksettingsfunction netdev_set_link_ksettingsfunction netdev_nway_resetfunction netdev_get_linkfunction netdev_get_msglevelfunction netdev_set_msglevelfunction netdev_ioctlfunction netdev_closefunction w840_remove1function spin_unlock_irqfunction w840_resume
Annotated Snippet
static const struct net_device_ops netdev_ops = {
.ndo_open = netdev_open,
.ndo_stop = netdev_close,
.ndo_start_xmit = start_tx,
.ndo_get_stats = get_stats,
.ndo_set_rx_mode = set_rx_mode,
.ndo_eth_ioctl = netdev_ioctl,
.ndo_tx_timeout = tx_timeout,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int w840_probe1(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct net_device *dev;
struct netdev_private *np;
static int find_cnt;
int chip_idx = ent->driver_data;
int irq;
int i, option = find_cnt < MAX_UNITS ? options[find_cnt] : 0;
__le16 addr[ETH_ALEN / 2];
void __iomem *ioaddr;
i = pcim_enable_device(pdev);
if (i) return i;
pci_set_master(pdev);
irq = pdev->irq;
if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
pr_warn("Device %s disabled due to DMA limitations\n",
pci_name(pdev));
return -EIO;
}
dev = alloc_etherdev(sizeof(*np));
if (!dev)
return -ENOMEM;
SET_NETDEV_DEV(dev, &pdev->dev);
if (pcim_request_all_regions(pdev, DRV_NAME))
goto err_out_netdev;
ioaddr = pci_iomap(pdev, TULIP_BAR, netdev_res_size);
if (!ioaddr)
goto err_out_netdev;
for (i = 0; i < 3; i++)
addr[i] = cpu_to_le16(eeprom_read(ioaddr, i));
eth_hw_addr_set(dev, (u8 *)addr);
/* Reset the chip to erase previous misconfiguration.
No hold time required! */
iowrite32(0x00000001, ioaddr + PCIBusCfg);
np = netdev_priv(dev);
np->pci_dev = pdev;
np->chip_id = chip_idx;
np->drv_flags = pci_id_tbl[chip_idx].drv_flags;
spin_lock_init(&np->lock);
np->mii_if.dev = dev;
np->mii_if.mdio_read = mdio_read;
np->mii_if.mdio_write = mdio_write;
np->base_addr = ioaddr;
pci_set_drvdata(pdev, dev);
if (dev->mem_start)
option = dev->mem_start;
/* The lower four bits are the media type. */
if (option > 0) {
if (option & 0x200)
np->mii_if.full_duplex = 1;
if (option & 15)
dev_info(&dev->dev,
"ignoring user supplied media type %d",
option & 15);
}
if (find_cnt < MAX_UNITS && full_duplex[find_cnt] > 0)
np->mii_if.full_duplex = 1;
if (np->mii_if.full_duplex)
np->mii_if.force_media = 1;
/* The chip-specific entries in the device structure. */
dev->netdev_ops = &netdev_ops;
dev->ethtool_ops = &netdev_ethtool_ops;
dev->watchdog_timeo = TX_TIMEOUT;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/string.h`, `linux/timer.h`, `linux/errno.h`, `linux/ioport.h`, `linux/interrupt.h`, `linux/pci.h`.
- Detected declarations: `struct pci_id_info`, `struct w840_rx_desc`, `struct w840_tx_desc`, `struct netdev_private`, `enum chip_capability_flags`, `enum w840_offsets`, `enum rx_mode_bits`, `enum mii_reg_bits`, `enum EEPROM_Ctrl_Bits`, `enum EEPROM_Cmds`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.