memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 
static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,				     const struct pci_device_id *ent){	struct net_device *dev;	int i;	unsigned char SA_prom[32];	int start_page, stop_page;	int irq, reg0, chip_idx = ent->driver_data;	static unsigned int fnd_cnt;	long ioaddr;	int flags = pci_clone_list[chip_idx].flags;/* when built into the kernel, we only print version if device is found */#ifndef MODULE	static int printed_version;	if (!printed_version++)		printk(version);#endif	fnd_cnt++;	i = pci_enable_device (pdev);	if (i)		return i;	ioaddr = pci_resource_start (pdev, 0);	irq = pdev->irq;	if (!ioaddr || ((pci_resource_flags (pdev, 0) & IORESOURCE_IO) == 0)) {		printk (KERN_ERR PFX "no I/O resource at PCI BAR #0\n");		return -ENODEV;	}	if (request_region (ioaddr, NE_IO_EXTENT, DRV_NAME) == NULL) {		printk (KERN_ERR PFX "I/O resource 0x%x @ 0x%lx busy\n",			NE_IO_EXTENT, ioaddr);		return -EBUSY;	}	reg0 = inb(ioaddr);	if (reg0 == 0xFF)		goto err_out_free_res;	/* Do a preliminary verification that we have a 8390. */	{		int regd;		outb(E8390_NODMA+E8390_PAGE1+E8390_STOP, ioaddr + E8390_CMD);		regd = inb(ioaddr + 0x0d);		outb(0xff, ioaddr + 0x0d);		outb(E8390_NODMA+E8390_PAGE0, ioaddr + E8390_CMD);		inb(ioaddr + EN0_COUNTER0); /* Clear the counter by reading. */		if (inb(ioaddr + EN0_COUNTER0) != 0) {			outb(reg0, ioaddr);			outb(regd, ioaddr + 0x0d);	/* Restore the old values. */			goto err_out_free_res;		}	}	/* Allocate net_device, dev->priv; fill in 8390 specific dev fields. */	dev = alloc_ei_netdev();	if (!dev) {		printk (KERN_ERR PFX "cannot allocate ethernet device\n");		goto err_out_free_res;	}	SET_MODULE_OWNER(dev);	SET_NETDEV_DEV(dev, &pdev->dev);	/* Reset card. Who knows what dain-bramaged state it was left in. */	{		unsigned long reset_start_time = jiffies;		outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET);		/* This looks like a horrible timing loop, but it should never take		   more than a few cycles.		*/		while ((inb(ioaddr + EN0_ISR) & ENISR_RESET) == 0)			/* Limit wait: '2' avoids jiffy roll-over. */			if (jiffies - reset_start_time > 2) {				printk(KERN_ERR PFX "Card failure (no reset ack).\n");				goto err_out_free_netdev;			}		outb(0xff, ioaddr + EN0_ISR);		/* Ack all intr. */	}	/* Read the 16 bytes of station address PROM.	   We must first initialize registers, similar to NS8390_init(eifdev, 0).	   We can't reliably read the SAPROM address without this.	   (I learned the hard way!). */	{		struct {unsigned char value, offset; } program_seq[] = {			{E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD}, /* Select page 0*/			{0x49,	EN0_DCFG},	/* Set word-wide access. */			{0x00,	EN0_RCNTLO},	/* Clear the count regs. */			{0x00,	EN0_RCNTHI},			{0x00,	EN0_IMR},	/* Mask completion irq. */			{0xFF,	EN0_ISR},			{E8390_RXOFF, EN0_RXCR},	/* 0x20  Set to monitor */			{E8390_TXOFF, EN0_TXCR},	/* 0x02  and loopback mode. */			{32,	EN0_RCNTLO},			{0x00,	EN0_RCNTHI},			{0x00,	EN0_RSARLO},	/* DMA starting at 0x0000. */			{0x00,	EN0_RSARHI},			{E8390_RREAD+E8390_START, E8390_CMD},		};		for (i = 0; i < sizeof(program_seq)/sizeof(program_seq[0]); i++)			outb(program_seq[i].value, ioaddr + program_seq[i].offset);	}	/* Note: all PCI cards have at least 16 bit access, so we don't have	   to check for 8 bit cards.  Most cards permit 32 bit access. */	if (flags & ONLY_32BIT_IO) {		for (i = 0; i < 4 ; i++)			((u32 *)SA_prom)[i] = le32_to_cpu(inl(ioaddr + NE_DATAPORT));	} else		for(i = 0; i < 32 /*sizeof(SA_prom)*/; i++)			SA_prom[i] = inb(ioaddr + NE_DATAPORT);	/* We always set the 8390 registers for word mode. */	outb(0x49, ioaddr + EN0_DCFG);	start_page = NESM_START_PG;	stop_page = flags & STOP_PG_0x60 ? 0x60 : NESM_STOP_PG;	/* Set up the rest of the parameters. */	dev->irq = irq;	dev->base_addr = ioaddr;	pci_set_drvdata(pdev, dev);	ei_status.name = pci_clone_list[chip_idx].name;	ei_status.tx_start_page = start_page;	ei_status.stop_page = stop_page;	ei_status.word16 = 1;	ei_status.ne2k_flags = flags;	if (fnd_cnt < MAX_UNITS) {		if (full_duplex[fnd_cnt] > 0  ||  (options[fnd_cnt] & FORCE_FDX))			ei_status.ne2k_flags |= FORCE_FDX;	}	ei_status.rx_start_page = start_page + TX_PAGES;#ifdef PACKETBUF_MEMSIZE	/* Allow the packet buffer size to be overridden by know-it-alls. */	ei_status.stop_page = ei_status.tx_start_page + PACKETBUF_MEMSIZE;#endif	ei_status.reset_8390 = &ne2k_pci_reset_8390;	ei_status.block_input = &ne2k_pci_block_input;	ei_status.block_output = &ne2k_pci_block_output;	ei_status.get_8390_hdr = &ne2k_pci_get_8390_hdr;	ei_status.priv = (unsigned long) pdev;	dev->open = &ne2k_pci_open;	dev->stop = &ne2k_pci_close;	dev->ethtool_ops = &ne2k_pci_ethtool_ops;#ifdef CONFIG_NET_POLL_CONTROLLER	dev->poll_controller = ei_poll;#endif	NS8390_init(dev, 0);	i = register_netdev(dev);	if (i)		goto err_out_free_netdev;	printk("%s: %s found at %#lx, IRQ %d, ",		   dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq);	for(i = 0; i < 6; i++) {		printk("%2.2X%s", SA_prom[i], i == 5 ? ".\n": ":");		dev->dev_addr[i] = SA_prom[i];	}	return 0;err_out_free_netdev:	free_netdev (dev);err_out_free_res:	release_region (ioaddr, NE_IO_EXTENT);	pci_set_drvdata (pdev, NULL);	return -ENODEV;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/78b345890a91dc57fecea8b6792012e0098c058f/ne2k-pci.c/buggy/drivers/net/ne2k-pci.c