drivers/net/ethernet/sis/sis900.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sis/sis900.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sis/sis900.c- Extension
.c- Size
- 75090 bytes
- Lines
- 2559
- 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/module.hlinux/moduleparam.hlinux/kernel.hlinux/sched.hlinux/string.hlinux/timer.hlinux/errno.hlinux/ioport.hlinux/slab.hlinux/interrupt.hlinux/pci.hlinux/netdevice.hlinux/init.hlinux/mii.hlinux/etherdevice.hlinux/skbuff.hlinux/delay.hlinux/ethtool.hlinux/crc32.hlinux/bitops.hlinux/dma-mapping.hasm/processor.hasm/io.hasm/irq.hlinux/uaccess.hsis900.h
Detected Declarations
struct mii_phystruct sis900_privatefunction read_eepromfunction sis630e_get_mac_addrfunction sis635_get_mac_addrfunction sis96x_get_mac_addrfunction sis900_probefunction sis900_mii_probefunction sis900_default_phyfunction sis900_set_capabilityfunction wordfunction mdio_idlefunction mdio_resetfunction protocolfunction protocolfunction sis900_reset_phyfunction sis900_pollfunction sis900_openfunction sis900_init_rxfilterfunction sis900_init_tx_ringfunction sis900_init_rx_ringfunction rulefunction statusfunction sis900_check_modefunction sis900_set_modefunction sis900_auto_negotiatefunction sis900_read_modefunction sis900_tx_timeoutfunction sis900_start_xmitfunction sis900_interruptfunction sis900_rxfunction sis900_finish_xmitfunction sis900_closefunction sis900_get_drvinfofunction sis900_get_msglevelfunction sis900_set_msglevelfunction sis900_get_linkfunction sis900_get_link_ksettingsfunction sis900_set_link_ksettingsfunction sis900_nway_resetfunction subsetfunction sis900_get_wolfunction sis900_get_eeprom_lenfunction sis900_read_eepromfunction sis900_get_eepromfunction mii_ioctlfunction sis900_set_configfunction sis900_mcast_bitnr
Annotated Snippet
static const struct net_device_ops sis900_netdev_ops = {
.ndo_open = sis900_open,
.ndo_stop = sis900_close,
.ndo_start_xmit = sis900_start_xmit,
.ndo_set_config = sis900_set_config,
.ndo_set_rx_mode = set_rx_mode,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
.ndo_eth_ioctl = mii_ioctl,
.ndo_tx_timeout = sis900_tx_timeout,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = sis900_poll,
#endif
};
/**
* sis900_probe - Probe for sis900 device
* @pci_dev: the sis900 pci device
* @pci_id: the pci device ID
*
* Check and probe sis900 net device for @pci_dev.
* Get mac address according to the chip revision,
* and assign SiS900-specific entries in the device structure.
* ie: sis900_open(), sis900_start_xmit(), sis900_close(), etc.
*/
static int sis900_probe(struct pci_dev *pci_dev,
const struct pci_device_id *pci_id)
{
struct sis900_private *sis_priv;
struct net_device *net_dev;
struct pci_dev *dev;
dma_addr_t ring_dma;
void *ring_space;
void __iomem *ioaddr;
int i, ret;
const char *card_name = card_names[pci_id->driver_data];
const char *dev_name = pci_name(pci_dev);
/* setup various bits in PCI command register */
ret = pcim_enable_device(pci_dev);
if(ret) return ret;
i = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32));
if(i){
printk(KERN_ERR "sis900.c: architecture does not support "
"32bit PCI busmaster DMA\n");
return i;
}
pci_set_master(pci_dev);
net_dev = alloc_etherdev(sizeof(struct sis900_private));
if (!net_dev)
return -ENOMEM;
SET_NETDEV_DEV(net_dev, &pci_dev->dev);
/* We do a request_region() to register /proc/ioports info. */
ret = pcim_request_all_regions(pci_dev, "sis900");
if (ret)
goto err_out;
/* IO region. */
ioaddr = pci_iomap(pci_dev, 0, 0);
if (!ioaddr) {
ret = -ENOMEM;
goto err_out;
}
sis_priv = netdev_priv(net_dev);
sis_priv->ioaddr = ioaddr;
sis_priv->pci_dev = pci_dev;
spin_lock_init(&sis_priv->lock);
sis_priv->eeprom_size = 24;
pci_set_drvdata(pci_dev, net_dev);
ring_space = dma_alloc_coherent(&pci_dev->dev, TX_TOTAL_SIZE,
&ring_dma, GFP_KERNEL);
if (!ring_space) {
ret = -ENOMEM;
goto err_out_unmap;
}
sis_priv->tx_ring = ring_space;
sis_priv->tx_ring_dma = ring_dma;
ring_space = dma_alloc_coherent(&pci_dev->dev, RX_TOTAL_SIZE,
&ring_dma, GFP_KERNEL);
if (!ring_space) {
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/kernel.h`, `linux/sched.h`, `linux/string.h`, `linux/timer.h`, `linux/errno.h`, `linux/ioport.h`.
- Detected declarations: `struct mii_phy`, `struct sis900_private`, `function read_eeprom`, `function sis630e_get_mac_addr`, `function sis635_get_mac_addr`, `function sis96x_get_mac_addr`, `function sis900_probe`, `function sis900_mii_probe`, `function sis900_default_phy`, `function sis900_set_capability`.
- 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.