memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 
static int __devinit rtl8139_init_one (struct pci_dev *pdev,				       const struct pci_device_id *ent){	struct net_device *dev = NULL;	struct rtl8139_private *tp;	int i, addr_len, option;	void __iomem *ioaddr;	static int board_idx = -1;	u8 pci_rev;	assert (pdev != NULL);	assert (ent != NULL);	board_idx++;	/* when we're built into the kernel, the driver version message	 * is only printed if at least one 8139 board has been found	 */#ifndef MODULE	{		static int printed_version;		if (!printed_version++)			printk (KERN_INFO RTL8139_DRIVER_NAME "\n");	}#endif	pci_read_config_byte(pdev, PCI_REVISION_ID, &pci_rev);	if (pdev->vendor == PCI_VENDOR_ID_REALTEK &&	    pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pci_rev >= 0x20) {		printk(KERN_INFO PFX "pci dev %s (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n",		       pci_name(pdev), pdev->vendor, pdev->device, pci_rev);		printk(KERN_INFO PFX "Use the \"8139cp\" driver for improved performance and stability.\n");	}	i = rtl8139_init_board (pdev, &dev);	if (i < 0)		return i;	assert (dev != NULL);	tp = netdev_priv(dev);	ioaddr = tp->mmio_addr;	assert (ioaddr != NULL);	addr_len = read_eeprom (ioaddr, 0, 8) == 0x8129 ? 8 : 6;	for (i = 0; i < 3; i++)		((u16 *) (dev->dev_addr))[i] =		    le16_to_cpu (read_eeprom (ioaddr, i + 7, addr_len));	/* The Rtl8139-specific entries in the device structure. */	dev->open = rtl8139_open;	dev->hard_start_xmit = rtl8139_start_xmit;	dev->poll = rtl8139_poll;	dev->weight = 64;	dev->stop = rtl8139_close;	dev->get_stats = rtl8139_get_stats;	dev->set_multicast_list = rtl8139_set_rx_mode;	dev->do_ioctl = netdev_ioctl;	dev->ethtool_ops = &rtl8139_ethtool_ops;	dev->tx_timeout = rtl8139_tx_timeout;	dev->watchdog_timeo = TX_TIMEOUT;#ifdef CONFIG_NET_POLL_CONTROLLER	dev->poll_controller = rtl8139_poll_controller;#endif	/* note: the hardware is not capable of sg/csum/highdma, however	 * through the use of skb_copy_and_csum_dev we enable these	 * features	 */	dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA;	dev->irq = pdev->irq;	/* tp zeroed and aligned in alloc_etherdev */	tp = netdev_priv(dev);	/* note: tp->chipset set in rtl8139_init_board */	tp->drv_flags = board_info[ent->driver_data].hw_flags;	tp->mmio_addr = ioaddr;	tp->msg_enable =		(debug < 0 ? RTL8139_DEF_MSG_ENABLE : ((1 << debug) - 1));	spin_lock_init (&tp->lock);	spin_lock_init (&tp->rx_lock);	init_waitqueue_head (&tp->thr_wait);	init_completion (&tp->thr_exited);	tp->mii.dev = dev;	tp->mii.mdio_read = mdio_read;	tp->mii.mdio_write = mdio_write;	tp->mii.phy_id_mask = 0x3f;	tp->mii.reg_num_mask = 0x1f;	/* dev is fully set up and ready to use now */	DPRINTK("about to register device named %s (%p)...\n", dev->name, dev);	i = register_netdev (dev);	if (i) goto err_out;	pci_set_drvdata (pdev, dev);	printk (KERN_INFO "%s: %s at 0x%lx, "		"%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, "		"IRQ %d\n",		dev->name,		board_info[ent->driver_data].name,		dev->base_addr,		dev->dev_addr[0], dev->dev_addr[1],		dev->dev_addr[2], dev->dev_addr[3],		dev->dev_addr[4], dev->dev_addr[5],		dev->irq);	printk (KERN_DEBUG "%s:  Identified 8139 chip type '%s'\n",		dev->name, rtl_chip_info[tp->chipset].name);	/* Find the connected MII xcvrs.	   Doing this in open() would allow detecting external xcvrs later, but	   takes too much time. */#ifdef CONFIG_8139TOO_8129	if (tp->drv_flags & HAS_MII_XCVR) {		int phy, phy_idx = 0;		for (phy = 0; phy < 32 && phy_idx < sizeof(tp->phys); phy++) {			int mii_status = mdio_read(dev, phy, 1);			if (mii_status != 0xffff  &&  mii_status != 0x0000) {				u16 advertising = mdio_read(dev, phy, 4);				tp->phys[phy_idx++] = phy;				printk(KERN_INFO "%s: MII transceiver %d status 0x%4.4x "					   "advertising %4.4x.\n",					   dev->name, phy, mii_status, advertising);			}		}		if (phy_idx == 0) {			printk(KERN_INFO "%s: No MII transceivers found!  Assuming SYM "				   "transceiver.\n",				   dev->name);			tp->phys[0] = 32;		}	} else#endif		tp->phys[0] = 32;	tp->mii.phy_id = tp->phys[0];	/* The lower four bits are the media type. */	option = (board_idx >= MAX_UNITS) ? 0 : media[board_idx];	if (option > 0) {		tp->mii.full_duplex = (option & 0x210) ? 1 : 0;		tp->default_port = option & 0xFF;		if (tp->default_port)			tp->mii.force_media = 1;	}	if (board_idx < MAX_UNITS  &&  full_duplex[board_idx] > 0)		tp->mii.full_duplex = full_duplex[board_idx];	if (tp->mii.full_duplex) {		printk(KERN_INFO "%s: Media type forced to Full Duplex.\n", dev->name);		/* Changing the MII-advertised media because might prevent		   re-connection. */		tp->mii.force_media = 1;	}	if (tp->default_port) {		printk(KERN_INFO "  Forcing %dMbps %s-duplex operation.\n",			   (option & 0x20 ? 100 : 10),			   (option & 0x10 ? "full" : "half"));		mdio_write(dev, tp->phys[0], 0,				   ((option & 0x20) ? 0x2000 : 0) | 	/* 100Mbps? */				   ((option & 0x10) ? 0x0100 : 0)); /* Full duplex? */	}	/* Put the chip into low-power mode. */	if (rtl_chip_info[tp->chipset].flags & HasHltClk)		RTL_W8 (HltClk, 'H');	/* 'R' would leave the clock running. */	return 0;err_out:	__rtl8139_cleanup_dev (dev);	pci_disable_device (pdev);	return i;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/62a720b889a37496d5f36d09875578956745d196/8139too.c/clean/drivers/net/8139too.c