drivers/net/ethernet/amd/a2065.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/amd/a2065.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/amd/a2065.c- Extension
.c- Size
- 20394 bytes
- Lines
- 786
- 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.
- 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/errno.hlinux/netdevice.hlinux/etherdevice.hlinux/module.hlinux/stddef.hlinux/kernel.hlinux/interrupt.hlinux/ioport.hlinux/skbuff.hlinux/string.hlinux/init.hlinux/crc32.hlinux/zorro.hlinux/bitops.hasm/byteorder.hasm/irq.hasm/amigaints.hasm/amigahw.ha2065.h
Detected Declarations
struct lance_init_blockstruct lance_privatefunction load_csrsfunction lance_init_ringfunction init_restart_lancefunction lance_rxfunction lance_txfunction lance_tx_buffs_availfunction lance_interruptfunction lance_openfunction lance_closefunction lance_resetfunction lance_tx_timeoutfunction lance_start_xmitfunction lance_load_multicastfunction lance_set_multicastfunction lance_set_multicast_retryfunction a2065_init_onefunction a2065_remove_onefunction a2065_init_modulefunction a2065_cleanup_modulemodule init a2065_init_module
Annotated Snippet
static const struct net_device_ops lance_netdev_ops = {
.ndo_open = lance_open,
.ndo_stop = lance_close,
.ndo_start_xmit = lance_start_xmit,
.ndo_tx_timeout = lance_tx_timeout,
.ndo_set_rx_mode = lance_set_multicast,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
};
static int a2065_init_one(struct zorro_dev *z,
const struct zorro_device_id *ent)
{
struct net_device *dev;
struct lance_private *priv;
unsigned long board = z->resource.start;
unsigned long base_addr = board + A2065_LANCE;
unsigned long mem_start = board + A2065_RAM;
struct resource *r1, *r2;
u8 addr[ETH_ALEN];
u32 serial;
int err;
r1 = request_mem_region(base_addr, sizeof(struct lance_regs),
"Am7990");
if (!r1)
return -EBUSY;
r2 = request_mem_region(mem_start, A2065_RAM_SIZE, "RAM");
if (!r2) {
release_mem_region(base_addr, sizeof(struct lance_regs));
return -EBUSY;
}
dev = alloc_etherdev(sizeof(struct lance_private));
if (!dev) {
release_mem_region(base_addr, sizeof(struct lance_regs));
release_mem_region(mem_start, A2065_RAM_SIZE);
return -ENOMEM;
}
priv = netdev_priv(dev);
r1->name = dev->name;
r2->name = dev->name;
serial = be32_to_cpu(z->rom.er_SerialNumber);
addr[0] = 0x00;
if (z->id != ZORRO_PROD_AMERISTAR_A2065) { /* Commodore */
addr[1] = 0x80;
addr[2] = 0x10;
} else { /* Ameristar */
addr[1] = 0x00;
addr[2] = 0x9f;
}
addr[3] = (serial >> 16) & 0xff;
addr[4] = (serial >> 8) & 0xff;
addr[5] = serial & 0xff;
eth_hw_addr_set(dev, addr);
dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
dev->mem_end = dev->mem_start + A2065_RAM_SIZE;
priv->ll = (volatile struct lance_regs *)dev->base_addr;
priv->init_block = (struct lance_init_block *)dev->mem_start;
priv->lance_init_block = (struct lance_init_block *)A2065_RAM;
priv->auto_select = 0;
priv->busmaster_regval = LE_C3_BSWP;
priv->lance_log_rx_bufs = LANCE_LOG_RX_BUFFERS;
priv->lance_log_tx_bufs = LANCE_LOG_TX_BUFFERS;
priv->rx_ring_mod_mask = RX_RING_MOD_MASK;
priv->tx_ring_mod_mask = TX_RING_MOD_MASK;
priv->dev = dev;
dev->netdev_ops = &lance_netdev_ops;
dev->watchdog_timeo = 5*HZ;
dev->dma = 0;
timer_setup(&priv->multicast_timer, lance_set_multicast_retry, 0);
err = register_netdev(dev);
if (err) {
release_mem_region(base_addr, sizeof(struct lance_regs));
release_mem_region(mem_start, A2065_RAM_SIZE);
free_netdev(dev);
return err;
}
zorro_set_drvdata(z, dev);
netdev_info(dev, "A2065 at 0x%08lx, Ethernet Address %pM\n",
Annotation
- Immediate include surface: `linux/errno.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/module.h`, `linux/stddef.h`, `linux/kernel.h`, `linux/interrupt.h`, `linux/ioport.h`.
- Detected declarations: `struct lance_init_block`, `struct lance_private`, `function load_csrs`, `function lance_init_ring`, `function init_restart_lance`, `function lance_rx`, `function lance_tx`, `function lance_tx_buffs_avail`, `function lance_interrupt`, `function lance_open`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- 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.