drivers/net/ethernet/seeq/ether3.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/seeq/ether3.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/seeq/ether3.c- Extension
.c- Size
- 23564 bytes
- Lines
- 899
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/types.hlinux/fcntl.hlinux/interrupt.hlinux/ioport.hlinux/in.hlinux/slab.hlinux/string.hlinux/errno.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/device.hlinux/init.hlinux/delay.hlinux/bitops.hasm/ecard.hasm/io.hether3.h
Detected Declarations
function ether3_outbfunction ether3_outwfunction ether3_setbufferfunction ether3_ledofffunction ether3_ledonfunction ether3_addrfunction ether3_ramtestfunction ether3_init_2function ether3_init_for_openfunction ether3_probe_bus_8function ether3_probe_bus_16function ether3_openfunction ether3_openfunction ether3_setmulticastlistfunction ether3_timeoutfunction ether3_sendpacketfunction ether3_interruptfunction packetfunction packetfunction ether3_bannerfunction ether3_probefunction ether3_removefunction ether3_initfunction ether3_exitmodule init ether3_init
Annotated Snippet
static const struct net_device_ops ether3_netdev_ops = {
.ndo_open = ether3_open,
.ndo_stop = ether3_close,
.ndo_start_xmit = ether3_sendpacket,
.ndo_set_rx_mode = ether3_setmulticastlist,
.ndo_tx_timeout = ether3_timeout,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
};
static int
ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
{
const struct ether3_data *data = id->data;
struct net_device *dev;
int bus_type, ret;
u8 addr[ETH_ALEN];
ether3_banner();
ret = ecard_request_resources(ec);
if (ret)
goto out;
dev = alloc_etherdev(sizeof(struct dev_priv));
if (!dev) {
ret = -ENOMEM;
goto release;
}
SET_NETDEV_DEV(dev, &ec->dev);
priv(dev)->base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
if (!priv(dev)->base) {
ret = -ENOMEM;
goto free;
}
ec->irqaddr = priv(dev)->base + data->base_offset;
ec->irqmask = 0xf0;
priv(dev)->seeq = priv(dev)->base + data->base_offset;
dev->irq = ec->irq;
ether3_addr(addr, ec);
eth_hw_addr_set(dev, addr);
priv(dev)->dev = dev;
timer_setup(&priv(dev)->timer, ether3_ledoff, 0);
/* Reset card...
*/
ether3_outb(0x80, REG_CONFIG2 + 4);
bus_type = BUS_UNKNOWN;
udelay(4);
/* Test using Receive Pointer (16-bit register) to find out
* how the ether3 is connected to the bus...
*/
if (ether3_probe_bus_8(dev, 0x100) &&
ether3_probe_bus_8(dev, 0x201))
bus_type = BUS_8;
if (bus_type == BUS_UNKNOWN &&
ether3_probe_bus_16(dev, 0x101) &&
ether3_probe_bus_16(dev, 0x201))
bus_type = BUS_16;
switch (bus_type) {
case BUS_UNKNOWN:
printk(KERN_ERR "%s: unable to identify bus width\n", dev->name);
ret = -ENODEV;
goto free;
case BUS_8:
printk(KERN_ERR "%s: %s found, but is an unsupported "
"8-bit card\n", dev->name, data->name);
ret = -ENODEV;
goto free;
default:
break;
}
if (ether3_init_2(dev)) {
ret = -ENODEV;
goto free;
}
dev->netdev_ops = ðer3_netdev_ops;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/types.h`, `linux/fcntl.h`, `linux/interrupt.h`, `linux/ioport.h`, `linux/in.h`, `linux/slab.h`.
- Detected declarations: `function ether3_outb`, `function ether3_outw`, `function ether3_setbuffer`, `function ether3_ledoff`, `function ether3_ledon`, `function ether3_addr`, `function ether3_ramtest`, `function ether3_init_2`, `function ether3_init_for_open`, `function ether3_probe_bus_8`.
- 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.