drivers/net/fddi/defza.c
Source file repositories/reference/linux-study-clean/drivers/net/fddi/defza.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/fddi/defza.c- Extension
.c- Size
- 42396 bytes
- Lines
- 1574
- 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/delay.hlinux/device.hlinux/dma-mapping.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/io-64-nonatomic-lo-hi.hlinux/ioport.hlinux/kernel.hlinux/list.hlinux/module.hlinux/netdevice.hlinux/fddidevice.hlinux/sched.hlinux/skbuff.hlinux/spinlock.hlinux/stat.hlinux/tc.hlinux/timer.hlinux/types.hlinux/wait.hasm/barrier.hdefza.h
Detected Declarations
function fza_skb_alignfunction fza_readsfunction fza_writesfunction fza_movesfunction fza_zerosfunction fza_regs_dumpfunction fza_do_resetfunction fza_do_shutdownfunction fza_resetfunction netdev_for_each_mc_addrfunction fza_init_sendfunction fza_rx_initfunction fza_set_rx_modefunction fza_do_xmitfunction fza_do_recv_smtfunction fza_txfunction fza_rx_errfunction fza_rxfunction fza_tx_smtfunction fza_do_xmitfunction fza_unsfunction fza_tx_flushfunction fza_interruptfunction fza_reset_timerfunction fza_set_mac_addressfunction fza_start_xmitfunction fza_openfunction fza_closefunction fza_probefunction fza_removefunction fza_initfunction fza_exitmodule init fza_init
Annotated Snippet
static const struct net_device_ops netdev_ops = {
.ndo_open = fza_open,
.ndo_stop = fza_close,
.ndo_start_xmit = fza_start_xmit,
.ndo_set_rx_mode = fza_set_rx_mode,
.ndo_set_mac_address = fza_set_mac_address,
.ndo_get_stats = fza_get_stats,
};
static int version_printed;
char rom_rev[4], fw_rev[4], rmc_rev[4];
struct tc_dev *tdev = to_tc_dev(bdev);
struct fza_cmd_init __iomem *init;
resource_size_t start, len;
struct net_device *dev;
struct fza_private *fp;
uint smt_ver, pmd_type;
void __iomem *mmio;
uint hw_addr[2];
int ret, i;
if (!version_printed) {
pr_info("%s", version);
version_printed = 1;
}
dev = alloc_fddidev(sizeof(*fp));
if (!dev)
return -ENOMEM;
SET_NETDEV_DEV(dev, bdev);
fp = netdev_priv(dev);
dev_set_drvdata(bdev, dev);
fp->bdev = bdev;
fp->name = dev_name(bdev);
/* Request the I/O MEM resource. */
start = tdev->resource.start;
len = tdev->resource.end - start + 1;
if (!request_mem_region(start, len, dev_name(bdev))) {
pr_err("%s: cannot reserve MMIO region\n", fp->name);
ret = -EBUSY;
goto err_out_kfree;
}
/* MMIO mapping setup. */
mmio = ioremap(start, len);
if (!mmio) {
pr_err("%s: cannot map MMIO\n", fp->name);
ret = -ENOMEM;
goto err_out_resource;
}
/* Initialize the new device structure. */
switch (loopback) {
case FZA_LOOP_NORMAL:
case FZA_LOOP_INTERN:
case FZA_LOOP_EXTERN:
break;
default:
loopback = FZA_LOOP_NORMAL;
}
fp->mmio = mmio;
dev->irq = tdev->interrupt;
pr_info("%s: DEC FDDIcontroller 700 or 700-C at 0x%08llx, irq %d\n",
fp->name, (long long)tdev->resource.start, dev->irq);
pr_debug("%s: mapped at: 0x%p\n", fp->name, mmio);
fp->regs = mmio + FZA_REG_BASE;
fp->ring_cmd = mmio + FZA_RING_CMD;
fp->ring_uns = mmio + FZA_RING_UNS;
init_waitqueue_head(&fp->state_chg_wait);
init_waitqueue_head(&fp->cmd_done_wait);
spin_lock_init(&fp->lock);
fp->int_mask = FZA_MASK_NORMAL;
timer_setup(&fp->reset_timer, fza_reset_timer, 0);
/* Sanitize the board. */
fza_regs_dump(fp);
fza_do_shutdown(fp);
ret = request_irq(dev->irq, fza_interrupt, IRQF_SHARED, fp->name, dev);
if (ret != 0) {
pr_err("%s: unable to get IRQ %d!\n", fp->name, dev->irq);
goto err_out_map;
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/dma-mapping.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/io-64-nonatomic-lo-hi.h`, `linux/ioport.h`.
- Detected declarations: `function fza_skb_align`, `function fza_reads`, `function fza_writes`, `function fza_moves`, `function fza_zeros`, `function fza_regs_dump`, `function fza_do_reset`, `function fza_do_shutdown`, `function fza_reset`, `function netdev_for_each_mc_addr`.
- 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.