drivers/net/ethernet/dec/tulip/xircom_cb.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/dec/tulip/xircom_cb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/dec/tulip/xircom_cb.c- Extension
.c- Size
- 29693 bytes
- Lines
- 1173
- 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/string.hlinux/errno.hlinux/ioport.hlinux/slab.hlinux/interrupt.hlinux/pci.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/delay.hlinux/bitops.hlinux/uaccess.hasm/io.hasm/irq.h
Detected Declarations
struct xircom_privatefunction print_binaryfunction xircom_probefunction xircom_removefunction xircom_interruptfunction xircom_start_xmitfunction xircom_openfunction xircom_closefunction xircom_poll_controllerfunction initialize_cardfunction trigger_transmitfunction trigger_receivefunction setup_descriptorsfunction remove_descriptorsfunction link_status_changedfunction transmit_activefunction receive_activefunction activate_receiverfunction deactivate_receiverfunction activate_transmitterfunction deactivate_transmitterfunction enable_transmit_interruptfunction enable_receive_interruptfunction enable_link_interruptfunction disable_all_interruptsfunction enable_common_interruptsfunction enable_promiscfunction link_statusfunction read_mac_addressfunction transceiver_voodoofunction xircom_upfunction investigate_read_descriptorfunction investigate_write_descriptor
Annotated Snippet
static struct pci_driver xircom_driver = {
.name = "xircom_cb",
.id_table = xircom_pci_table,
.probe = xircom_probe,
.remove = xircom_remove,
};
#if defined DEBUG && DEBUG > 1
static void print_binary(unsigned int number)
{
int i,i2;
char buffer[64];
memset(buffer,0,64);
i2=0;
for (i=31;i>=0;i--) {
if (number & (1<<i))
buffer[i2++]='1';
else
buffer[i2++]='0';
if ((i&3)==0)
buffer[i2++]=' ';
}
pr_debug("%s\n",buffer);
}
#endif
static const struct net_device_ops netdev_ops = {
.ndo_open = xircom_open,
.ndo_stop = xircom_close,
.ndo_start_xmit = xircom_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = xircom_poll_controller,
#endif
};
/* xircom_probe is the code that gets called on device insertion.
it sets up the hardware and registers the device to the networklayer.
TODO: Send 1 or 2 "dummy" packets here as the card seems to discard the
first two packets that get send, and pump hates that.
*/
static int xircom_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
struct device *d = &pdev->dev;
struct net_device *dev = NULL;
struct xircom_private *private;
unsigned long flags;
unsigned short tmp16;
int rc;
/* First do the PCI initialisation */
rc = pci_enable_device(pdev);
if (rc < 0)
goto out;
/* disable all powermanagement */
pci_write_config_dword(pdev, PCI_POWERMGMT, 0x0000);
pci_set_master(pdev); /* Why isn't this done by pci_enable_device ?*/
/* clear PCI status, if any */
pci_read_config_word (pdev,PCI_STATUS, &tmp16);
pci_write_config_word (pdev, PCI_STATUS,tmp16);
rc = pci_request_regions(pdev, "xircom_cb");
if (rc < 0) {
pr_err("%s: failed to allocate io-region\n", __func__);
goto err_disable;
}
rc = -ENOMEM;
/*
Before changing the hardware, allocate the memory.
This way, we can fail gracefully if not enough memory
is available.
*/
dev = alloc_etherdev(sizeof(struct xircom_private));
if (!dev)
goto err_release;
private = netdev_priv(dev);
/* Allocate the send/receive buffers */
private->rx_buffer = dma_alloc_coherent(d, 8192,
&private->rx_dma_handle,
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/string.h`, `linux/errno.h`, `linux/ioport.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/pci.h`.
- Detected declarations: `struct xircom_private`, `function print_binary`, `function xircom_probe`, `function xircom_remove`, `function xircom_interrupt`, `function xircom_start_xmit`, `function xircom_open`, `function xircom_close`, `function xircom_poll_controller`, `function initialize_card`.
- 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.