drivers/net/ethernet/smsc/smc91x.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/smsc/smc91x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/smsc/smc91x.c- Extension
.c- Size
- 64867 bytes
- Lines
- 2480
- 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/sched.hlinux/delay.hlinux/gpio/consumer.hlinux/interrupt.hlinux/irq.hlinux/errno.hlinux/ioport.hlinux/crc32.hlinux/platform_device.hlinux/spinlock.hlinux/ethtool.hlinux/mii.hlinux/workqueue.hlinux/of.hlinux/of_device.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hasm/io.hsmc91x.hmach/assabet.hmach/neponset.h
Detected Declarations
function PRINT_PKTfunction PRINT_PKTfunction smc_resetfunction smc_enablefunction smc_shutdownfunction smc_rcvfunction smc_hardware_send_pktfunction smc_hard_start_xmitfunction smc_txfunction smc_mii_outfunction smc_mii_infunction smc_phy_readfunction smc_phy_writefunction smc_phy_detectfunction smc_phy_fixedfunction smc_phy_resetfunction smc_phy_powerdownfunction smc_phy_check_mediafunction smc_phy_fixedfunction smc_phy_interruptfunction smc_10bt_check_mediafunction smc_eph_interruptfunction smc_interruptfunction smc_poll_controllerfunction smc_timeoutfunction modefunction netdev_for_each_mc_addrfunction smc_openfunction smc_closefunction smc_ethtool_get_link_ksettingsfunction smc_ethtool_set_link_ksettingsfunction smc_ethtool_getdrvinfofunction smc_ethtool_nwayresetfunction smc_ethtool_getmsglevelfunction smc_ethtool_setmsglevelfunction smc_write_eeprom_wordfunction smc_read_eeprom_wordfunction smc_ethtool_geteeprom_lenfunction smc_ethtool_geteepromfunction smc_ethtool_seteepromfunction smc_findirqfunction smc_probefunction whatfunction smc_enable_devicefunction smc_request_attribfunction smc_release_attribfunction smc_request_datacsfunction smc_release_datacs
Annotated Snippet
static const struct net_device_ops smc_netdev_ops = {
.ndo_open = smc_open,
.ndo_stop = smc_close,
.ndo_start_xmit = smc_hard_start_xmit,
.ndo_tx_timeout = smc_timeout,
.ndo_set_rx_mode = smc_set_multicast_list,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = smc_poll_controller,
#endif
};
/*
* smc_findirq
*
* This routine has a simple purpose -- make the SMC chip generate an
* interrupt, so an auto-detect routine can detect it, and find the IRQ,
*/
/*
* does this still work?
*
* I just deleted auto_irq.c, since it was never built...
* --jgarzik
*/
static int smc_findirq(struct smc_local *lp)
{
void __iomem *ioaddr = lp->base;
int timeout = 20;
unsigned long cookie;
DBG(2, lp->dev, "%s: %s\n", CARDNAME, __func__);
cookie = probe_irq_on();
/*
* What I try to do here is trigger an ALLOC_INT. This is done
* by allocating a small chunk of memory, which will give an interrupt
* when done.
*/
/* enable ALLOCation interrupts ONLY */
SMC_SELECT_BANK(lp, 2);
SMC_SET_INT_MASK(lp, IM_ALLOC_INT);
/*
* Allocate 512 bytes of memory. Note that the chip was just
* reset so all the memory is available
*/
SMC_SET_MMU_CMD(lp, MC_ALLOC | 1);
/*
* Wait until positive that the interrupt has been generated
*/
do {
int int_status;
udelay(10);
int_status = SMC_GET_INT(lp);
if (int_status & IM_ALLOC_INT)
break; /* got the interrupt */
} while (--timeout);
/*
* there is really nothing that I can do here if timeout fails,
* as autoirq_report will return a 0 anyway, which is what I
* want in this case. Plus, the clean up is needed in both
* cases.
*/
/* and disable all interrupts again */
SMC_SET_INT_MASK(lp, 0);
/* and return what I found */
return probe_irq_off(cookie);
}
/*
* Function: smc_probe(unsigned long ioaddr)
*
* Purpose:
* Tests to see if a given ioaddr points to an SMC91x chip.
* Returns a 0 on success
*
* Algorithm:
* (1) see if the high byte of BANK_SELECT is 0x33
* (2) compare the ioaddr with the base register's address
* (3) see if I recognize the chip ID in the appropriate register
*
* Here I do typical initialization tasks.
*
* o Initialize the structure if needed
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/sched.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/errno.h`.
- Detected declarations: `function PRINT_PKT`, `function PRINT_PKT`, `function smc_reset`, `function smc_enable`, `function smc_shutdown`, `function smc_rcv`, `function smc_hardware_send_pkt`, `function smc_hard_start_xmit`, `function smc_tx`, `function smc_mii_out`.
- 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.