drivers/net/ethernet/dec/tulip/tulip_core.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/dec/tulip/tulip_core.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/dec/tulip/tulip_core.c
Extension
.c
Size
57365 bytes
Lines
1932
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.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct net_device_ops tulip_netdev_ops = {
	.ndo_open		= tulip_open,
	.ndo_start_xmit		= tulip_start_xmit,
	.ndo_tx_timeout		= tulip_tx_timeout,
	.ndo_stop		= tulip_close,
	.ndo_get_stats		= tulip_get_stats,
	.ndo_eth_ioctl		= private_ioctl,
	.ndo_set_rx_mode	= set_rx_mode,
	.ndo_set_mac_address	= eth_mac_addr,
	.ndo_validate_addr	= eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
	.ndo_poll_controller	 = poll_tulip,
#endif
};

static const struct pci_device_id early_486_chipsets[] = {
	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_82424) },
	{ PCI_VDEVICE(SI, PCI_DEVICE_ID_SI_496) },
	{ },
};

static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	struct tulip_private *tp;
	/* See note below on the multiport cards. */
	static unsigned char last_phys_addr[ETH_ALEN] = {
		0x00, 'L', 'i', 'n', 'u', 'x'
	};
#if defined(__i386__) || defined(__x86_64__)	/* Patch up x86 BIOS bug. */
	static int last_irq;
#endif
	int i, irq;
	unsigned short sum;
	unsigned char *ee_data;
	struct net_device *dev;
	void __iomem *ioaddr;
	static int board_idx = -1;
	int chip_idx = ent->driver_data;
	const char *chip_name = tulip_tbl[chip_idx].chip_name;
	unsigned int eeprom_missing = 0;
	u8 addr[ETH_ALEN] __aligned(2);
	unsigned int force_csr0 = 0;

	board_idx++;

	/*
	 *	Lan media wire a tulip chip to a wan interface. Needs a very
	 *	different driver (lmc driver)
	 */

        if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) {
		pr_err("skipping LMC card\n");
		return -ENODEV;
	} else if (pdev->subsystem_vendor == PCI_VENDOR_ID_SBE &&
		   (pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_T3E3 ||
		    pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P0 ||
		    pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P1)) {
		pr_err("skipping SBE T3E3 port\n");
		return -ENODEV;
	}

	/*
	 *	DM910x chips should be handled by the dmfe driver, except
	 *	on-board chips on SPARC systems.  Also, early DM9100s need
	 *	software CRC which only the dmfe driver supports.
	 */

#ifdef CONFIG_TULIP_DM910X
	if (chip_idx == DM910X) {
		struct device_node *dp;

		if (pdev->vendor == 0x1282 && pdev->device == 0x9100 &&
		    pdev->revision < 0x30) {
			pr_info("skipping early DM9100 with Crc bug (use dmfe)\n");
			return -ENODEV;
		}

		dp = pci_device_to_OF_node(pdev);
		if (!(dp && of_get_property(dp, "local-mac-address", NULL))) {
			pr_info("skipping DM910x expansion card (use dmfe)\n");
			return -ENODEV;
		}
	}
#endif

	/*
	 *	Looks for early PCI chipsets where people report hangs
	 *	without the workarounds being on.
	 */

Annotation

Implementation Notes