drivers/net/ethernet/broadcom/sb1250-mac.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/sb1250-mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/sb1250-mac.c- Extension
.c- Size
- 64460 bytes
- Lines
- 2617
- 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.
- 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/bug.hlinux/module.hlinux/kernel.hlinux/string.hlinux/timer.hlinux/errno.hlinux/ioport.hlinux/slab.hlinux/interrupt.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/bitops.hlinux/err.hlinux/ethtool.hlinux/mii.hlinux/phy.hlinux/platform_device.hlinux/prefetch.hasm/cache.hasm/io.hasm/processor.hasm/sibyte/board.hasm/sibyte/sb1250.hasm/sibyte/bcm1480_regs.hasm/sibyte/bcm1480_int.hasm/sibyte/sb1250_regs.hasm/sibyte/sb1250_int.hasm/sibyte/sb1250_scd.hasm/sibyte/sb1250_mac.hasm/sibyte/sb1250_dma.h
Detected Declarations
struct sbdmadscrstruct sbmacdmastruct sbmac_softcenum sbmac_speedenum sbmac_duplexenum sbmac_fcenum sbmac_statefunction SBMAC_MII_SYNCfunction SBMAC_MII_SENDDATAfunction SBMAC_MII_READfunction SBMAC_MII_WRITEfunction SBDMA_INITCTXfunction SBDMA_CHANNEL_STARTfunction SBDMA_CHANNEL_STOPfunction sbdma_align_skbfunction SBDMA_ADD_RCVBUFFERfunction beginningfunction SBDMA_ADD_TXBUFFERfunction sbdma_emptyringfunction SBDMA_FILLRINGfunction sbmac_netpollfunction SBDMA_RX_PROCESSfunction SBDMA_TX_PROCESSfunction SBMAC_INITCTXfunction sbdma_uninitctxfunction sbmac_uninitctxfunction SBMAC_CHANNEL_STARTfunction SBMAC_CHANNEL_STOPfunction SBMAC_SET_CHANNEL_STATEfunction SBMAC_PROMISCUOUS_MODEfunction SBMAC_SETIPHDR_OFFSETfunction SBMAC_ADDR2REGfunction SBMAC_SET_SPEEDfunction SBMAC_SET_DUPLEXfunction SBMAC_INTRfunction SBMAC_START_TXfunction SBMAC_SETMULTIfunction SBMAC_INITfunction sbmac_openfunction sbmac_mii_probefunction sbmac_mii_pollfunction sbmac_tx_timeoutfunction sbmac_set_rx_modefunction sbmac_mii_ioctlfunction sbmac_closefunction sbmac_pollfunction sbmac_probefunction sbmac_remove
Annotated Snippet
static const struct net_device_ops sbmac_netdev_ops = {
.ndo_open = sbmac_open,
.ndo_stop = sbmac_close,
.ndo_start_xmit = sbmac_start_tx,
.ndo_set_rx_mode = sbmac_set_rx_mode,
.ndo_tx_timeout = sbmac_tx_timeout,
.ndo_eth_ioctl = sbmac_mii_ioctl,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = sbmac_netpoll,
#endif
};
/**********************************************************************
* SBMAC_INIT(dev)
*
* Attach routine - init hardware and hook ourselves into linux
*
* Input parameters:
* dev - net_device structure
*
* Return value:
* status
********************************************************************* */
static int sbmac_init(struct platform_device *pldev, long long base)
{
struct net_device *dev = platform_get_drvdata(pldev);
int idx = pldev->id;
struct sbmac_softc *sc = netdev_priv(dev);
unsigned char *eaddr;
uint64_t ea_reg;
int i;
int err;
sc->sbm_dev = dev;
sc->sbe_idx = idx;
eaddr = sc->sbm_hwaddr;
/*
* Read the ethernet address. The firmware left this programmed
* for us in the ethernet address register for each mac.
*/
ea_reg = __raw_readq(sc->sbm_base + R_MAC_ETHERNET_ADDR);
__raw_writeq(0, sc->sbm_base + R_MAC_ETHERNET_ADDR);
for (i = 0; i < 6; i++) {
eaddr[i] = (uint8_t) (ea_reg & 0xFF);
ea_reg >>= 8;
}
eth_hw_addr_set(dev, eaddr);
/*
* Initialize context (get pointers to registers and stuff), then
* allocate the memory for the descriptor tables.
*/
sbmac_initctx(sc);
/*
* Set up Linux device callins
*/
spin_lock_init(&(sc->sbm_lock));
dev->netdev_ops = &sbmac_netdev_ops;
dev->watchdog_timeo = TX_TIMEOUT;
dev->min_mtu = 0;
dev->max_mtu = ENET_PACKET_SIZE;
netif_napi_add_weight(dev, &sc->napi, sbmac_poll, 16);
dev->irq = UNIT_INT(idx);
/* This is needed for PASS2 for Rx H/W checksum feature */
sbmac_set_iphdr_offset(sc);
sc->mii_bus = mdiobus_alloc();
if (sc->mii_bus == NULL) {
err = -ENOMEM;
goto uninit_ctx;
}
sc->mii_bus->name = sbmac_mdio_string;
snprintf(sc->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
pldev->name, idx);
sc->mii_bus->priv = sc;
Annotation
- Immediate include surface: `linux/bug.h`, `linux/module.h`, `linux/kernel.h`, `linux/string.h`, `linux/timer.h`, `linux/errno.h`, `linux/ioport.h`, `linux/slab.h`.
- Detected declarations: `struct sbdmadscr`, `struct sbmacdma`, `struct sbmac_softc`, `enum sbmac_speed`, `enum sbmac_duplex`, `enum sbmac_fc`, `enum sbmac_state`, `function SBMAC_MII_SYNC`, `function SBMAC_MII_SENDDATA`, `function SBMAC_MII_READ`.
- 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.