drivers/net/ethernet/xircom/xirc2ps_cs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/xircom/xirc2ps_cs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/xircom/xirc2ps_cs.c- Extension
.c- Size
- 53298 bytes
- Lines
- 1795
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/init.hlinux/ptrace.hlinux/slab.hlinux/string.hlinux/timer.hlinux/interrupt.hlinux/in.hlinux/delay.hlinux/ethtool.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/if_arp.hlinux/ioport.hlinux/bitops.hlinux/mii.hpcmcia/cistpl.hpcmcia/cisreg.hpcmcia/ciscode.hasm/io.hlinux/uaccess.hpcmcia/ds.h
Detected Declarations
struct local_infostruct set_address_infoenum xirc_crenum xirc_esrenum xirc_isrenum xirc_rsrenum xirc_ecrenum xirc_cmdfunction PrintRegistersfunction mii_idlefunction mii_putbitfunction mii_getbitfunction mii_wbitsfunction mii_rdfunction mii_wrfunction xirc2ps_probefunction xirc2ps_detachfunction set_card_typefunction has_ce2_stringfunction xirc2ps_config_modemfunction xirc2ps_config_checkfunction pcmcia_get_mac_cefunction xirc2ps_configfunction xirc2ps_releasefunction xirc2ps_suspendfunction xirc2ps_resumefunction xirc2ps_interruptfunction xirc2ps_tx_timeout_taskfunction xirc_tx_timeoutfunction do_start_xmitfunction set_addressfunction set_addressesfunction set_multicast_listfunction do_configfunction do_openfunction netdev_get_drvinfofunction do_ioctlfunction hardresetfunction do_resetfunction init_miifunction do_powerdownfunction do_stopfunction setup_xirc2ps_cs
Annotated Snippet
static const struct net_device_ops netdev_ops = {
.ndo_open = do_open,
.ndo_stop = do_stop,
.ndo_start_xmit = do_start_xmit,
.ndo_tx_timeout = xirc_tx_timeout,
.ndo_set_config = do_config,
.ndo_eth_ioctl = do_ioctl,
.ndo_set_rx_mode = set_multicast_list,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int
xirc2ps_probe(struct pcmcia_device *link)
{
struct net_device *dev;
struct local_info *local;
dev_dbg(&link->dev, "attach()\n");
/* Allocate the device structure */
dev = alloc_etherdev(sizeof(struct local_info));
if (!dev)
return -ENOMEM;
local = netdev_priv(dev);
local->dev = dev;
local->p_dev = link;
link->priv = dev;
/* General socket configuration */
link->config_index = 1;
/* Fill in card specific entries */
dev->netdev_ops = &netdev_ops;
dev->ethtool_ops = &netdev_ethtool_ops;
dev->watchdog_timeo = TX_TIMEOUT;
INIT_WORK(&local->tx_timeout_task, xirc2ps_tx_timeout_task);
return xirc2ps_config(link);
} /* xirc2ps_attach */
static void
xirc2ps_detach(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
struct local_info *local = netdev_priv(dev);
netif_carrier_off(dev);
netif_tx_disable(dev);
cancel_work_sync(&local->tx_timeout_task);
dev_dbg(&link->dev, "detach\n");
unregister_netdev(dev);
xirc2ps_release(link);
free_netdev(dev);
} /* xirc2ps_detach */
/****************
* Detect the type of the card. s is the buffer with the data of tuple 0x20
* Returns: 0 := not supported
* mediaid=11 and prodid=47
* Media-Id bits:
* Ethernet 0x01
* Tokenring 0x02
* Arcnet 0x04
* Wireless 0x08
* Modem 0x10
* GSM only 0x20
* Prod-Id bits:
* Pocket 0x10
* External 0x20
* Creditcard 0x40
* Cardbus 0x80
*
*/
static int
set_card_type(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
struct local_info *local = netdev_priv(dev);
u8 *buf;
unsigned int cisrev, mediaid, prodid;
size_t len;
len = pcmcia_get_tuple(link, CISTPL_MANFID, &buf);
if (len < 5) {
dev_err(&link->dev, "invalid CIS -- sorry\n");
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/ptrace.h`, `linux/slab.h`, `linux/string.h`, `linux/timer.h`, `linux/interrupt.h`.
- Detected declarations: `struct local_info`, `struct set_address_info`, `enum xirc_cr`, `enum xirc_esr`, `enum xirc_isr`, `enum xirc_rsr`, `enum xirc_ecr`, `enum xirc_cmd`, `function PrintRegisters`, `function mii_idle`.
- 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.