drivers/net/ethernet/8390/pcnet_cs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/8390/pcnet_cs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/8390/pcnet_cs.c- Extension
.c- Size
- 62026 bytes
- Lines
- 1718
- 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/kernel.hlinux/module.hlinux/ptrace.hlinux/string.hlinux/timer.hlinux/delay.hlinux/netdevice.hlinux/log2.hlinux/etherdevice.hlinux/mii.h8390.hpcmcia/cistpl.hpcmcia/ciscode.hpcmcia/ds.hpcmcia/cisreg.hasm/io.hasm/byteorder.hlinux/uaccess.h
Detected Declarations
struct hw_infostruct pcnet_devfunction pcnet_probefunction pcnet_detachfunction try_io_portfunction pcnet_confcheckfunction pcnet_configfunction pcnet_releasefunction pcnet_suspendfunction pcnet_resumefunction mdio_syncfunction mdio_readfunction mdio_writefunction read_eepromfunction write_asicfunction set_misc_regfunction mii_phy_probefunction pcnet_openfunction pcnet_closefunction pcnet_reset_8390function set_configfunction ei_irq_wrapperfunction ei_watchdogfunction ei_ioctlfunction dma_get_8390_hdrfunction dma_block_inputfunction dma_block_outputfunction setup_dma_configfunction copyinfunction copyoutfunction shmem_get_8390_hdrfunction shmem_block_inputfunction shmem_block_outputfunction setup_shmem_window
Annotated Snippet
static const struct net_device_ops pcnet_netdev_ops = {
.ndo_open = pcnet_open,
.ndo_stop = pcnet_close,
.ndo_set_config = set_config,
.ndo_start_xmit = ei_start_xmit,
.ndo_get_stats = ei_get_stats,
.ndo_eth_ioctl = ei_ioctl,
.ndo_set_rx_mode = ei_set_multicast_list,
.ndo_tx_timeout = ei_tx_timeout,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = ei_poll,
#endif
};
static int pcnet_probe(struct pcmcia_device *link)
{
struct pcnet_dev *info;
struct net_device *dev;
dev_dbg(&link->dev, "pcnet_attach()\n");
/* Create new ethernet device */
dev = __alloc_ei_netdev(sizeof(struct pcnet_dev));
if (!dev) return -ENOMEM;
info = PRIV(dev);
info->p_dev = link;
link->priv = dev;
link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
dev->netdev_ops = &pcnet_netdev_ops;
return pcnet_config(link);
} /* pcnet_attach */
static void pcnet_detach(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
dev_dbg(&link->dev, "pcnet_detach\n");
unregister_netdev(dev);
pcnet_release(link);
free_netdev(dev);
} /* pcnet_detach */
/*======================================================================
This probes for a card's hardware address, for card types that
encode this information in their CIS.
======================================================================*/
static struct hw_info *get_hwinfo(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
u_char __iomem *base, *virt;
u8 addr[ETH_ALEN];
int i, j;
/* Allocate a small memory window */
link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
link->resource[2]->start = 0; link->resource[2]->end = 0;
i = pcmcia_request_window(link, link->resource[2], 0);
if (i != 0)
return NULL;
virt = ioremap(link->resource[2]->start,
resource_size(link->resource[2]));
if (unlikely(!virt)) {
pcmcia_release_window(link, link->resource[2]);
return NULL;
}
for (i = 0; i < NR_INFO; i++) {
pcmcia_map_mem_page(link, link->resource[2],
hw_info[i].offset & ~(resource_size(link->resource[2])-1));
base = &virt[hw_info[i].offset & (resource_size(link->resource[2])-1)];
if ((readb(base+0) == hw_info[i].a0) &&
(readb(base+2) == hw_info[i].a1) &&
(readb(base+4) == hw_info[i].a2)) {
for (j = 0; j < 6; j++)
addr[j] = readb(base + (j<<1));
eth_hw_addr_set(dev, addr);
break;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/ptrace.h`, `linux/string.h`, `linux/timer.h`, `linux/delay.h`, `linux/netdevice.h`, `linux/log2.h`.
- Detected declarations: `struct hw_info`, `struct pcnet_dev`, `function pcnet_probe`, `function pcnet_detach`, `function try_io_port`, `function pcnet_confcheck`, `function pcnet_config`, `function pcnet_release`, `function pcnet_suspend`, `function pcnet_resume`.
- 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.